Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why update statement doesn't work

Status
Not open for further replies.

chrisdq

Programmer
Nov 6, 2002
77
US
Hi,

I can't figure out why the update query to access database doesn't work from ASP while it works fine with the select statement.
Here is what is have for the update statement

Public function testUpdate
dim conn, rs, x, correctpass, username, sqlquery, SQL

set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "C:/Inetpub/ set rs = Server.CreateObject("ADODB.recordset")

SQL = "UPDATE records " & _
"SET records.userid = '33dell' " & _
"WHERE records.username = 'dell'"
rs.Open SQL, conn

rs.close
conn.close
end function

I keep getting the error "No value given for one or more required parameters.
session-class.asp, line 85 which points to
rs.Open SQL, conn.
Can anyone see why it doesn't work?
Thank for anyone can help.
 
Generally when you get that error from Access it's because you have mispelled a field name in your SQL statement. try pasting that statement directly into Access and see if it pops up an input to get a value for one of the field names. If it does then that field is either mispelled or hasn't been added to your table yet.



 
Recordset objects aren't meant for doing UPDATE statements, they're meant for retrieving data. Use an ADODB.Command object instead.
 
I got it to work.
I was supposed to use rs.execute (sql) instead of rs.Open SQL, conn.

Thanks everyone.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top