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

Arguments are of the wrong type, Error, stuck...doomed.

Status
Not open for further replies.

maverik59

Programmer
Oct 30, 2002
67
0
0
GB
Hi, This 'simple' script I've made is supposed to check the parameters from the url (random number) check against those in the database and then activate the users account but it won't work and i'm not sure why. Any ideas,Its been a long day.... Thanks

<%
DIM objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("database/fiat127.mdb") & ";"
objConn.Open


'Get the parameters from the email URL
user_mail = Request.QueryString("email")
auth_code = Request.QueryString("activate")
auth_int = CLng(auth_code)
%>

<%
check = "SELECT * FROM users WHERE random_auth ="&auth_int
objConn.Execute check

If objConn.check.EOF Then (**THE ERROR IS HERE, **)
authenticate = "UPDATE users SET auth_flag=True WHERE random_auth="&auth_int
objConn.Execute authenticate
%>

<%
Response.Redirect("confirmed.asp")
Else
Response.Redirect("confirmed_error.asp")
End If
%>
 
you are brining back items from the db (a recordset) you need to use the recordset object to make this work..try something like...

Code:
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("database/fiat127.mdb") & ";"
objConn.Open

[b]rsCheck = Server.CreateObject("ADODB.recordset")[/b]

'Get the parameters from the email URL
user_mail = Request.QueryString("email")
auth_code = Request.QueryString("activate")
auth_int = CLng(auth_code)

check = "SELECT * FROM users WHERE random_auth ="&auth_int
[b]rsCheck.open check[/b]

If [b]rsCheck.EOF[/b] Then '(**THE ERROR IS HERE, **)
authenticate = "UPDATE users SET auth_flag=True WHERE random_auth="&auth_int
objConn.Execute authenticate
%>


Bastien

Cat, the other other white meat
 
I still get this error message, I'm going to sleep now, thanks for the idea i will have a look in the morning. Very much appreciate your help, i've spent all day messing round with it.

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'Open'

/si/activate.asp, line 18

Cheers

 
get this working yet?


Bastien

Cat, the other other white meat
 
Another option, that will prove more efficient, is simply to assign the output of your execute line to a recordset:
Code:
<%
DIM objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("database/fiat127.mdb") & ";"
objConn.Open


'Get the parameters from the email URL
user_mail = Request.QueryString("email")
auth_code = Request.QueryString("activate")
auth_int = CLng(auth_code)
%>

<%
check = "SELECT * FROM users WHERE random_auth ="&auth_int
[highlight]Set objRS = objConn.Execute(check)[/highlight]

If [highlight]objRS.EOF[/highlight] Then (**THE ERROR IS HERE, **)
authenticate = "UPDATE users SET auth_flag=True WHERE random_auth="&auth_int
objConn.Execute authenticate
%>

<%
Response.Redirect("confirmed.asp")
Else
Response.Redirect("confirmed_error.asp")
End If
%>

Generally if you use a .Open method on a recordset object you get the default cursor type (which is supposed to be forward only) but then the object tries to read your mind and do wierd things to satisfy you, which eats at memory and performance. Plus I like the Conn.Execute method better :)

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
The never-completed website:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top