M
middletree
I'm used to doing ASP with SQL Server, but now I'm doing something with
Access. Never understood connection strongs, but managed to get by with
pasted code. Now, I can't make this work. Can anyone see what's wrong?
Background: This page is what shows up after the page with the form in it.
That page uses the Post method and points to this one. Database is called
Shape, the table this time is called Personal. Error I get is pasted at the
end.
---------------------------------------
(include adovbs.inc)
objConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Inetpub\wwwroot\Grace\Shape.mdb;User Id=admin;Password=;"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "Personal", objConnection, adOpenStatic, adLockPessimistic,
adCmdTable
' *** request variables from the form ***
strFirstName = Replace(Trim(Request.Form("FirstName")),"'","''")
strLastname = Replace(Trim(Request.Form("LastName")),"'","''")
strSQL = "set nocount on; INSERT INTO Personal(FirstName,LastName) VALUES
(strFirstName,strLastName); select @@identity [newid];"
Set rs=objConnection.execute (strSQL)
strPersonalID = RS("newid")
rs.Close
Set rs = Nothing
--------------------------------------
a.. Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'objConnection'
/grace/shapethankyou.asp, line 149
where line 149 is the one which says:
Set rs=objConnection.execute (strSQL)
Access. Never understood connection strongs, but managed to get by with
pasted code. Now, I can't make this work. Can anyone see what's wrong?
Background: This page is what shows up after the page with the form in it.
That page uses the Post method and points to this one. Database is called
Shape, the table this time is called Personal. Error I get is pasted at the
end.
---------------------------------------
(include adovbs.inc)
objConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Inetpub\wwwroot\Grace\Shape.mdb;User Id=admin;Password=;"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "Personal", objConnection, adOpenStatic, adLockPessimistic,
adCmdTable
' *** request variables from the form ***
strFirstName = Replace(Trim(Request.Form("FirstName")),"'","''")
strLastname = Replace(Trim(Request.Form("LastName")),"'","''")
strSQL = "set nocount on; INSERT INTO Personal(FirstName,LastName) VALUES
(strFirstName,strLastName); select @@identity [newid];"
Set rs=objConnection.execute (strSQL)
strPersonalID = RS("newid")
rs.Close
Set rs = Nothing
--------------------------------------
a.. Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'objConnection'
/grace/shapethankyou.asp, line 149
where line 149 is the one which says:
Set rs=objConnection.execute (strSQL)