Click to See Complete Forum and Search --> : how to use "addnew" function in Access DataBase


Awei Ken
July 19th, 2000, 02:25 AM
Hi
In my ASP code ,I have a problem .I want to add a new record in a Access DataBase. But IE reports
error like this
"ADODB.Recordset error'800a0cb3'
The operation requested by the application is not supported by the provider. "
/guestbook/AddUserInfo.asp, line 8

my ASP Code is
"
LocalArray=Application("StoredArray")'line 2

Set conn = server.createobject("adodb.connection")
Set rst=Server.Createobject("ADODB.Recordset")
conn.open "aem","sa", ""
rst.Open "UserInfo",conn , , , adCmdTable
rst.AddNew 'report error line 8
rst(name)=LocalArray(1)
rst(sex)=LocalArray(3)
rst(email)=LocalArray(2)
rst.update
"
thank you

Johnny101
July 22nd, 2000, 03:03 PM
First try setting the cursorlocation property to adUseClient on the connection and recordset. (i think the integer value is 3- but double check that in VB first)
If that doesn't work, then I would suggeset building a SQL string and then executing that - its faster and easier on the server as well.


dim sql

LocalArray=Application("StoredArray")'line 2

sql = "INSERT INTO aem VALUES ('" & LocalArray(1) & "', "
sql = sql & "'" & LocalArray(2) & "', '" & LocalArray(3) & "')"

set conn = server.createobject("adodb.connection")

conn.open "aem","sa", ""

conn.execute sql




hope this helps,

John


John Pirkey
MCSD
http://www.ShallowWaterSystems.com
http://www.stlvbug.org