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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

recordset.addnew giving me error

Status
Not open for further replies.

JohannIcon

Programmer
Sep 3, 2002
440
MT
I have the following code:-

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source = " & Server.MapPath("../pnwebsite.mdb") & ";" & _
"Persist Security Info=False"

Set cnn=Server.CreateObject("ADODB.Connection")
cnn.Open strConn

set rsTable = Server.CreateObject("ADODB.Recordset")
sqlquery = "SELECT * FROM Users WHERE (Name = " & PerName & ") and (Surname = " & PerSurname & ") and (Email = " & PerEmail & ")"
rsTable.open sqlquery, cnn, adOpenStatic, adLockOptimistic, adCmdText

if rsTable.EOF then
''Add a new record
rsTable.addnew
rsTable("Name") = PerName
rsTable("Surname") = PerSurname
rsTable("Email") = PerEmail
rsTable("LastPollVoted") = PerPoll
rsTable("DateRegistered") = PerDateReg
rsTable("Password") = PerPassword

rsTable.update
rsTable.close
cnn.close
end if

but the browser is giving me the following error:-

ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

What is the problem?

Thanks for your help!
 
try putting single quotes around your strings in the SQL query:
Code:
sqlquery = "SELECT * FROM Users WHERE (Name = '" & PerName & "') and (Surname = '" & PerSurname & "') and (Email = '" & PerEmail & "')"
Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
Hey thanks for your reply.

I already did that in the opening of the script:-

PerName = "'" & request.Form("issem") & "'"
PerSurname = "'" & request.Form("kunjom") & "'"
PerEmail = "'" & request.Form("email") & "'"
PerPassword = "'" & "12345" & "'"
PerPoll = 0
PerDateReg = Date()
 
Hi FesterSXS,

I took another road, I used the rs.addnew and it worked fine. Thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top