Microsoft OLE DB Provider for ODBC Drivers (0x80040E10) [Microsoft][ODBC Microsoft Access Driver] To
am 24.01.2005 01:08:01 von Ebrahim Sidat
I'm getting the following error message when i try to input the
information through the page and then its going to write to database.
Please see below for my query.
Any Idea?
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsAddComments 'Holds the recordset for the new record to be added
to the database
Dim strSQL 'Holds the SQL query for the database
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less
connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("hardware.mdb")
'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=hardware"
'Create an ADO recordset object
Set rsAddComments = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the
database
strSQL = "SELECT tblhardware.SystemID, tblhardware.HostName,
tblhardware.HostModel, tblhardware.HostS/N, tblhardware.OpenDate,
tblhardware.OpenBy, tblhardware.Vendor, tblhardware.Ticketno,
tblhardware.Partno, tblhardware.PartName, tblhardware.PartModel,
tblhardware.Contact, tblhardware.ContactTel, tblhardware.Email,
tblhardware.ErrorReport, tblhardware.ReplaceBy, tblhardware.ReplaceDate,
tblhardware.Comments FROM tblhardware;"
'Set the cursor type we are using so we can navigate through the
recordset
rsAddComments.CursorType = 2
'Set the lock type so that the record is locked by ADO when it is
updated
rsAddComments.LockType = 3
'Open the hardware table using the SQL query held in the strSQL
varaiable
rsAddComments.Open strSQL, adoCon
'Tell the recordset we are adding a new record to it
rsAddComments.AddNew
'Add a new record to the recordset
rsAddComments.Fields("HostName") = Request.Form("hostname")
rsAddComments.Fields("HostModel") = Request.Form("hostmodel")
rsAddComments.Fields("HostS/N") = Request.Form("hosts/n")
rsAddComments.Fields("OpenDate") = Request.Form("opendate")
rsAddComments.Fields("OpenBy") = Request.Form("openby")
rsAddComments.Fields("Vendor") = Request.Form("vendor")
rsAddComments.Fields("Ticketno") = Request.Form("ticketno")
rsAddComments.Fields("Partno") = Request.Form("partno")
rsAddComments.Fields("PartName") = Request.Form("partname")
rsAddComments.Fields("PartModel") = Request.Form("partmodel")
rsAddComments.Fields("Contact") = Request.Form("contact")
rsAddComments.Fields("ContactTel") = Request.Form("contacttel")
rsAddComments.Fields("Email") = Request.Form("email")
rsAddComments.Fields("ErrorReport") = Request.Form("errorreport")
rsAddComments.Fields("ReplaceBy") = Request.Form("replaceby")
rsAddComments.Fields("ReplaceDate") = Request.Form("replacedate")
rsAddComments.Fields("Comments") = Request.Form("comments")
'Write the updated recordset to the database
rsAddComments.Update
'Reset server objects
rsAddComments.Close
Set rsAddComments = Nothing
Set adoCon = Nothing
'Redirect to the guestbook.asp page
Response.Redirect "index.htm"
%>
Thanks,
Ebrahim.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Re: Microsoft OLE DB Provider for ODBC Drivers (0x80040E10) [Microsoft][ODBC Microsoft Access Driver
am 24.01.2005 02:22:50 von ten.xoc
Why are you using a recordset for this (you're not retrieving any data)?
How about an INSERT statement (which you can then debug) or, better yet, a
call to a stored query? Also, please use the JET/OLEDB driver as opposed to
the obsolete ODBC driver... http://www.aspfaq.com/2126
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Ebrahim Sidat" wrote in message
news:e1HiFjaAFHA.3160@TK2MSFTNGP12.phx.gbl...
> I'm getting the following error message when i try to input the
> information through the page and then its going to write to database.
> Please see below for my query.
> Any Idea?
>
>
> <%
>
> 'Dimension variables
> Dim adoCon 'Holds the Database Connection Object
> Dim rsAddComments 'Holds the recordset for the new record to be added
> to the database
> Dim strSQL 'Holds the SQL query for the database
>
> 'Create an ADO connection odject
> Set adoCon = Server.CreateObject("ADODB.Connection")
>
> 'Set an active connection to the Connection object using a DSN-less
> connection
> adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
> Server.MapPath("hardware.mdb")
>
> 'Set an active connection to the Connection object using DSN connection
> 'adoCon.Open "DSN=hardware"
>
> 'Create an ADO recordset object
> Set rsAddComments = Server.CreateObject("ADODB.Recordset")
>
> 'Initialise the strSQL variable with an SQL statement to query the
> database
> strSQL = "SELECT tblhardware.SystemID, tblhardware.HostName,
> tblhardware.HostModel, tblhardware.HostS/N, tblhardware.OpenDate,
> tblhardware.OpenBy, tblhardware.Vendor, tblhardware.Ticketno,
> tblhardware.Partno, tblhardware.PartName, tblhardware.PartModel,
> tblhardware.Contact, tblhardware.ContactTel, tblhardware.Email,
> tblhardware.ErrorReport, tblhardware.ReplaceBy, tblhardware.ReplaceDate,
> tblhardware.Comments FROM tblhardware;"
>
> 'Set the cursor type we are using so we can navigate through the
> recordset
> rsAddComments.CursorType = 2
>
> 'Set the lock type so that the record is locked by ADO when it is
> updated
> rsAddComments.LockType = 3
>
> 'Open the hardware table using the SQL query held in the strSQL
> varaiable
> rsAddComments.Open strSQL, adoCon
>
> 'Tell the recordset we are adding a new record to it
> rsAddComments.AddNew
>
> 'Add a new record to the recordset
> rsAddComments.Fields("HostName") = Request.Form("hostname")
> rsAddComments.Fields("HostModel") = Request.Form("hostmodel")
> rsAddComments.Fields("HostS/N") = Request.Form("hosts/n")
> rsAddComments.Fields("OpenDate") = Request.Form("opendate")
> rsAddComments.Fields("OpenBy") = Request.Form("openby")
> rsAddComments.Fields("Vendor") = Request.Form("vendor")
> rsAddComments.Fields("Ticketno") = Request.Form("ticketno")
> rsAddComments.Fields("Partno") = Request.Form("partno")
> rsAddComments.Fields("PartName") = Request.Form("partname")
> rsAddComments.Fields("PartModel") = Request.Form("partmodel")
> rsAddComments.Fields("Contact") = Request.Form("contact")
> rsAddComments.Fields("ContactTel") = Request.Form("contacttel")
> rsAddComments.Fields("Email") = Request.Form("email")
> rsAddComments.Fields("ErrorReport") = Request.Form("errorreport")
> rsAddComments.Fields("ReplaceBy") = Request.Form("replaceby")
> rsAddComments.Fields("ReplaceDate") = Request.Form("replacedate")
> rsAddComments.Fields("Comments") = Request.Form("comments")
>
>
> 'Write the updated recordset to the database
> rsAddComments.Update
>
> 'Reset server objects
> rsAddComments.Close
> Set rsAddComments = Nothing
> Set adoCon = Nothing
>
> 'Redirect to the guestbook.asp page
> Response.Redirect "index.htm"
> %>
>
> Thanks,
> Ebrahim.
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!