I keep getting this error message when I try to edit a record in my database of employees:
"[Microsoft][ODBC Microsoft Access Driver] Internal OLE Automation error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e21'
And then when I try to search for a specific employee I get this:
"The request properties can not be supported by this ODBC Driver".
And this is the line to which it refers.
"rsRecords.Open sql, Conn, adOpenKeyset, adLockReadOnly, adCmdText"
I have a connection to the database because all the other features work such as adding an employee or searching for a specific department. Then all of the employees of that department are returned. I just can't edit a record or search for a specific employee.
Do I need to update my driver? Here's my code:
<%@ LANGUAGE="VBSCRIPT" %>
<%
Depts = Application("Depts"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
for i = 0 to UBound(Depts,2)
if Cstr(Depts(0,i)) = request.querystring("DepartmentID"
or Cstr(Depts(0,i)) = request.form("DepartmentID"
then
strDept = Depts(1,i)
end if
next
if request.querystring("DepartmentID"
<> "" then
Session("DeptID"
= request.querystring("DepartmentID"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
end if
On Error Resume Next
dim Conn, name, dept, homePhone, ext, id, oldName, sql
if request.form("Name"
<> "" then
name = Request.Form("Name"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
dept = Request.Form("DepartmentID"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
homePhone = Request.Form("Home_Phone"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
ext = Request.Form("Extension"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
id = request.form("ID"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
oldName = request.form("oldName"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Set Conn = Server.CreateObject("ADODB.Connection"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Conn.open("employee"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
if request.form("deleteMe"
= "DELETE" then
sql = "DELETE FROM Employees"
else
sql = "UPDATE Employees SET "
sql = sql & "DepartmentID=" & dept & "," & "Name = '"
sql = sql & replace(name,"'","'"
& "',"
sql = sql & "Home_Phone = '" & homePhone & "',"
sql = sql & "Extension = '" & ext & "'"
end if
sql = sql & " WHERE DepartmentID=" & Session("DeptID"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
sql = sql & " AND ID =" & id
sql = sql & " AND Name = '"
sql = sql & replace(oldName,"'","'"
& "'"
'Debug
'Response.write(sql)
Conn.Execute(sql)
Conn.Close
%>
<html>
<head>
<% if left(sql,6) = "DELETE" then %>
<title>Deletion Results</title>
<style>
<!--
body,td {background-color: #ffffff; color: #000080; font-weight: bold;}
-->
</style>
</head>
<body>
<h2>Deletion Results</h2>
<hr>
<b>The record you deleted:</b><p>
<% elseif left(sql,6) = "UPDATE" then %>
<title>Update Results</title>
<style>
<!--
body,td {background-color: #ffffff; color: #000080; font-weight: bold;}
-->
</style>
</head>
<body>
<h2>Update Results</h2>
<hr>
<b>The record you updated now contains:</b><p>
<%
if err.number <> 0 then
response.write("An error occurred with your input.<BR>"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
response.write("You probably have a conflict with another input (no duplicate extensions).<br>"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
response.write("The following data was <i>not</i> added to the employee database.<br>Please try again.<p>"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
response.write(err.description & "<p>"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
end if
end if
%>
<table border="1">
<tr><td>Department<td><%=strDept %>
<tr><td>Name<td><%=name %>
<tr><td>Home Phone<td><%=homePhone%>
<tr><td>Extension<td><%=ext %>
</table>
<p><br>
<!-- #include file="footer.inc"-->
</body>
</html>
<%
else
%>
<!--#include file="validate.inc"-->
<html>
<head>
<title>Update/Delete</title>
<style>
<!--
body {background-color: #ffffff; color: #000080}
-->
</style>
</head>
<body>
<h2>Update/Delete a record</h2>
<hr>
<table>
<form name="empForm" method="post" action="edit.asp">
<tr><td align="right" Valign="top"><b>Department:</B>
<td><select name="DepartmentID">
<%
Depts = Application("Depts"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
for i = 0 to UBound(Depts,2)
response.write("<OPTION "![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
if Cstr(Depts(0,i)) = request.querystring("DepartmentID"
then
response.write("SELECTED"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
end if
response.write(" value=" & Depts(0,i) & ">" & Depts(1,i))
next
%>
</select>
<tr><td align="right" Valign="top"><b>Name:</b><td><input type="text" name="Name" value="<%=request.querystring("Name"
%>">
<tr><td align="right" Valign="top"><b>Home Phone:</b><td><input type="text" name="Home_Phone" value="<%=request.querystring("Home_Phone"
%>">
<tr><td align="right" Valign="top"><b>Extension:</b><td><input type="text" name="Extension" value="<%=request.querystring("Extension"
%>">
<p><p>
<tr><td align="center" colspan="2">
<input type="hidden" name="ID" value="<%=request.querystring("ID"
%>">
<input type="hidden" name="oldName" value="<%=request.querystring("Name"
%>">
<input type="hidden" name="deleteMe">
<input type="button" name="cmdSubmit" value="Update" OnClick="Validate()">
<input type="reset" name="cmdReset" value="Reset">
<input type="button" name="cmdDelete" value="Delete" OnClick="funcDelete()">
</form>
</table>
<p><br>
<!-- #include file="footer.inc"-->
<script language="Javascript">
<!--
// This routine validates the input from the form
function Validate() {
//var iCount = 0;
if (document.forms[0].Name.value == ""
{
alert("Please enter a value for Name"
;
document.forms[0].Name.focus();
return;
}
if (document.forms[0].Home_Phone.value == ""
{
alert("Please enter a value for Home Phone"
;
document.forms[0].Home_Phone.focus();
return;
}
if (document.forms[0].Extension.value == ""
{
alert("Please enter a value for Extension"
;
document.forms[0].Extension.focus();
return;
}
if(confirm("You are about to update a record for: \n <%=strDept%> (<%=replace(request.querystring("Name"
,"'","'",1,-1,1)%>) \n Are you sure you want to proceed?"
){
document.forms[0].submit();
}
return;
}
function funcDelete() {
if(confirm("You are about to delete a record for: \n <%=strDept%> (<%=replace(request.querystring("Name"
,"'","'",1,-1,1)%>) \n Are you sure you want to proceed?"
){
document.forms[0].deleteMe.value = "DELETE";
document.forms[0].submit();
}
return;
}
//-->
</script>
</body>
</html>
<% end if %>
Thanks to anyone who can help. I couldn't find any other question like this and I'm at the end of my resources!!
Von
"[Microsoft][ODBC Microsoft Access Driver] Internal OLE Automation error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e21'
And then when I try to search for a specific employee I get this:
"The request properties can not be supported by this ODBC Driver".
And this is the line to which it refers.
"rsRecords.Open sql, Conn, adOpenKeyset, adLockReadOnly, adCmdText"
I have a connection to the database because all the other features work such as adding an employee or searching for a specific department. Then all of the employees of that department are returned. I just can't edit a record or search for a specific employee.
Do I need to update my driver? Here's my code:
<%@ LANGUAGE="VBSCRIPT" %>
<%
Depts = Application("Depts"
for i = 0 to UBound(Depts,2)
if Cstr(Depts(0,i)) = request.querystring("DepartmentID"
strDept = Depts(1,i)
end if
next
if request.querystring("DepartmentID"
Session("DeptID"
end if
On Error Resume Next
dim Conn, name, dept, homePhone, ext, id, oldName, sql
if request.form("Name"
name = Request.Form("Name"
dept = Request.Form("DepartmentID"
homePhone = Request.Form("Home_Phone"
ext = Request.Form("Extension"
id = request.form("ID"
oldName = request.form("oldName"
Set Conn = Server.CreateObject("ADODB.Connection"
Conn.open("employee"
if request.form("deleteMe"
sql = "DELETE FROM Employees"
else
sql = "UPDATE Employees SET "
sql = sql & "DepartmentID=" & dept & "," & "Name = '"
sql = sql & replace(name,"'","'"
sql = sql & "Home_Phone = '" & homePhone & "',"
sql = sql & "Extension = '" & ext & "'"
end if
sql = sql & " WHERE DepartmentID=" & Session("DeptID"
sql = sql & " AND ID =" & id
sql = sql & " AND Name = '"
sql = sql & replace(oldName,"'","'"
'Debug
'Response.write(sql)
Conn.Execute(sql)
Conn.Close
%>
<html>
<head>
<% if left(sql,6) = "DELETE" then %>
<title>Deletion Results</title>
<style>
<!--
body,td {background-color: #ffffff; color: #000080; font-weight: bold;}
-->
</style>
</head>
<body>
<h2>Deletion Results</h2>
<hr>
<b>The record you deleted:</b><p>
<% elseif left(sql,6) = "UPDATE" then %>
<title>Update Results</title>
<style>
<!--
body,td {background-color: #ffffff; color: #000080; font-weight: bold;}
-->
</style>
</head>
<body>
<h2>Update Results</h2>
<hr>
<b>The record you updated now contains:</b><p>
<%
if err.number <> 0 then
response.write("An error occurred with your input.<BR>"
response.write("You probably have a conflict with another input (no duplicate extensions).<br>"
response.write("The following data was <i>not</i> added to the employee database.<br>Please try again.<p>"
response.write(err.description & "<p>"
end if
end if
%>
<table border="1">
<tr><td>Department<td><%=strDept %>
<tr><td>Name<td><%=name %>
<tr><td>Home Phone<td><%=homePhone%>
<tr><td>Extension<td><%=ext %>
</table>
<p><br>
<!-- #include file="footer.inc"-->
</body>
</html>
<%
else
%>
<!--#include file="validate.inc"-->
<html>
<head>
<title>Update/Delete</title>
<style>
<!--
body {background-color: #ffffff; color: #000080}
-->
</style>
</head>
<body>
<h2>Update/Delete a record</h2>
<hr>
<table>
<form name="empForm" method="post" action="edit.asp">
<tr><td align="right" Valign="top"><b>Department:</B>
<td><select name="DepartmentID">
<%
Depts = Application("Depts"
for i = 0 to UBound(Depts,2)
response.write("<OPTION "
if Cstr(Depts(0,i)) = request.querystring("DepartmentID"
response.write("SELECTED"
end if
response.write(" value=" & Depts(0,i) & ">" & Depts(1,i))
next
%>
</select>
<tr><td align="right" Valign="top"><b>Name:</b><td><input type="text" name="Name" value="<%=request.querystring("Name"
<tr><td align="right" Valign="top"><b>Home Phone:</b><td><input type="text" name="Home_Phone" value="<%=request.querystring("Home_Phone"
<tr><td align="right" Valign="top"><b>Extension:</b><td><input type="text" name="Extension" value="<%=request.querystring("Extension"
<p><p>
<tr><td align="center" colspan="2">
<input type="hidden" name="ID" value="<%=request.querystring("ID"
<input type="hidden" name="oldName" value="<%=request.querystring("Name"
<input type="hidden" name="deleteMe">
<input type="button" name="cmdSubmit" value="Update" OnClick="Validate()">
<input type="reset" name="cmdReset" value="Reset">
<input type="button" name="cmdDelete" value="Delete" OnClick="funcDelete()">
</form>
</table>
<p><br>
<!-- #include file="footer.inc"-->
<script language="Javascript">
<!--
// This routine validates the input from the form
function Validate() {
//var iCount = 0;
if (document.forms[0].Name.value == ""
alert("Please enter a value for Name"
document.forms[0].Name.focus();
return;
}
if (document.forms[0].Home_Phone.value == ""
alert("Please enter a value for Home Phone"
document.forms[0].Home_Phone.focus();
return;
}
if (document.forms[0].Extension.value == ""
alert("Please enter a value for Extension"
document.forms[0].Extension.focus();
return;
}
if(confirm("You are about to update a record for: \n <%=strDept%> (<%=replace(request.querystring("Name"
document.forms[0].submit();
}
return;
}
function funcDelete() {
if(confirm("You are about to delete a record for: \n <%=strDept%> (<%=replace(request.querystring("Name"
document.forms[0].deleteMe.value = "DELETE";
document.forms[0].submit();
}
return;
}
//-->
</script>
</body>
</html>
<% end if %>
Thanks to anyone who can help. I couldn't find any other question like this and I'm at the end of my resources!!
Von