Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Error "Arguments are of the wrong type..."


Message #1 by Wendy_wang@m... on Wed, 20 Sep 2000 19:30:29 +0100
Hi,Team:



I am running the following ASP:



"<%



strUserID = Request.Form("txtID")

strPasswordID = Request.Form("txtPassword")



strSQL = "SELECT uid "

strSQL = strSQL & "FROM SysUsers "

strSQL = strSQL & "WHERE Name = '" & strUserID & "'"

strSQL = strSQL & "AND Convert(Password AS varchar(20)) = '" &

strPasswordID & "'"



strConnect = "Provider=SQLOLEDB.1;Persist Security Info=False;User

ID=MyID;Password = MyPasssword; Initial Catalog=MyCatalog;Data Source

MyServer"



Set objRS = Server.CreateObject("ADODB.Recordset")

objRS.Open strSQL,strConnect,adOpenForwardOnly,adLockReadOnly,adCmdText





If objRS.EOF and objRS.BOF then

' user combination does not exist

objRS.close

Set objRS = Nothing



Response.Write " Sorry, system couldn't let you login. Please reenter your

UserId and Password and try again!"



Else

'user exists

Rsponse.Redirect("ThardInfo.asp")



objRS.close

Set objRS = Nothing

End If

%>" 



THEN got the follwing error:



"ADODB.Recordset (0x800A0BB9)

Arguments are of the wrong type, are out of acceptable range, or are in

conflict with one another"



Does anybody have any suggestions about this?



Thanks in advance.



Wendy Wang

Message #2 by smartin@c... on Wed, 20 Sep 2000 16:07:44 -0400
Try the following changes to the first two lines:



strUserID = CStr(Request.form("txtID"))

strPasswordID = CStr(Request.form("txtPassword"))



Also, why do you need to do the conversion within your SQL statement?  Why

not just "AND Password = "...



-Stephen



> -----Original Message-----

> From: Wendy_wang@m... [mailto:Wendy_wang@m...]

> Sent: Wednesday, September 20, 2000 2:30 PM

> To: ASP Databases

> Subject: [asp_databases] Error "Arguments are of the wrong type..."

> 

> 

> Hi,Team:

> 

> I am running the following ASP:

> 

> "<%

> 

> strUserID = Request.Form("txtID")

> strPasswordID = Request.Form("txtPassword")

> 

> strSQL = "SELECT uid "

> strSQL = strSQL & "FROM SysUsers "

> strSQL = strSQL & "WHERE Name = '" & strUserID & "'"

> strSQL = strSQL & "AND Convert(Password AS varchar(20)) = '" &

> strPasswordID & "'"

> 

> strConnect = "Provider=SQLOLEDB.1;Persist Security Info=False;User

> ID=MyID;Password = MyPasssword; Initial Catalog=MyCatalog;Data Source

> MyServer"

> 

> Set objRS = Server.CreateObject("ADODB.Recordset")

> objRS.Open 

> strSQL,strConnect,adOpenForwardOnly,adLockReadOnly,adCmdText

> 

> 

> If objRS.EOF and objRS.BOF then

> ' user combination does not exist

> objRS.close

> Set objRS = Nothing

> 

> Response.Write " Sorry, system couldn't let you login. Please 

> reenter your

> UserId and Password and try again!"

> 

> Else

> 'user exists

> Rsponse.Redirect("ThardInfo.asp")

> 

> objRS.close

> Set objRS = Nothing

> End If

> %>" 

> 

> THEN got the follwing error:

> 

> "ADODB.Recordset (0x800A0BB9)

> Arguments are of the wrong type, are out of acceptable range, 

> or are in

> conflict with one another"

> 

> Does anybody have any suggestions about this?

> 

> Thanks in advance.

> 

> Wendy Wang

> 

Message #3 by Imar Spaanjaars <Imar@S...> on Wed, 20 Sep 2000 23:10:08 +0200
Sounds also like adOpenForwardOnly etc is not defined. Did you include the 

constants or the whole adovbs.inc file??



Imar





At 04:07 PM 9/20/2000 -0400, you wrote:

>Try the following changes to the first two lines:

>

>strUserID = CStr(Request.form("txtID"))

>strPasswordID = CStr(Request.form("txtPassword"))

>

>Also, why do you need to do the conversion within your SQL statement?  Why

>not just "AND Password = "...

>

>-Stephen

>

> > -----Original Message-----

> > From: Wendy_wang@m... [mailto:Wendy_wang@m...]

> > Sent: Wednesday, September 20, 2000 2:30 PM

> > To: ASP Databases

> > Subject: [asp_databases] Error "Arguments are of the wrong type..."

> >

> >

> > Hi,Team:

> >

> > I am running the following ASP:

> >

> > "<%

> >

> > strUserID = Request.Form("txtID")

> > strPasswordID = Request.Form("txtPassword")

> >

> > strSQL = "SELECT uid "

> > strSQL = strSQL & "FROM SysUsers "

> > strSQL = strSQL & "WHERE Name = '" & strUserID & "'"

> > strSQL = strSQL & "AND Convert(Password AS varchar(20)) = '" &

> > strPasswordID & "'"

> >

> > strConnect = "Provider=SQLOLEDB.1;Persist Security Info=False;User

> > ID=MyID;Password = MyPasssword; Initial Catalog=MyCatalog;Data Source

> > MyServer"

> >

> > Set objRS = Server.CreateObject("ADODB.Recordset")

> > objRS.Open

> > strSQL,strConnect,adOpenForwardOnly,adLockReadOnly,adCmdText

> >

> >

> > If objRS.EOF and objRS.BOF then

> > ' user combination does not exist

> > objRS.close

> > Set objRS = Nothing

> >

> > Response.Write " Sorry, system couldn't let you login. Please

> > reenter your

> > UserId and Password and try again!"

> >

> > Else

> > 'user exists

> > Rsponse.Redirect("ThardInfo.asp")

> >

> > objRS.close

> > Set objRS = Nothing

> > End If

> > %>"

> >

> > THEN got the follwing error:

> >

> > "ADODB.Recordset (0x800A0BB9)

> > Arguments are of the wrong type, are out of acceptable range,

> > or are in

> > conflict with one another"

> >

> > Does anybody have any suggestions about this?

> >

> > Thanks in advance.

> >

> > Wendy Wang

> >

>



Message #4 by "Ken Schaefer" <ken@a...> on Thu, 21 Sep 2000 13:14:24 +1000
http://www.adopenstatic.com/faq/800a0bb9.asp



Cheers

Ken



----- Original Message ----- 

From: <Wendy_wang@m...>

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, September 21, 2000 4:30 AM

Subject: [asp_databases] Error "Arguments are of the wrong type..."





> Hi,Team:

> 

> I am running the following ASP:

> 



<snip>



Message #5 by Wendy_wang@m... on Thu, 21 Sep 2000 19:58:35 +0100
I appreciate everyone who gave your suggests. Now I got a big improvement.

 The reason I need to use the conversion is because the data type of 

"strPasswordID = Request.Form("txtPassword")" is varchar and the data type

of Password in Sysusers is varbinary.



Now I am running the following:



"<!--#Include File = "Adovbs.inc"-->



<%



strUserID = Request.Form("txtID")

strPasswordID = Request.Form("txtPassword")



strSQL = "SELECT * "

strSQL = strSQL & "FROM SysUsers "

strSQL = strSQL & "WHERE Name = '" & strUserID & "'"

strSQL = strSQL & "AND Password = Convert(varbinary(256), '" &

strPasswordID & "' )"



strConnect = "Provider=SQLOLEDB.1;Persist Security Info=False;User

ID=sa;Password = es; Initial Catalog=Serverinfo;Data Source=Mcfr1d07"



Set objRS = Server.CreateObject("ADODB.Recordset")

objRS.Open strSQL,strConnect,adOpenForwardOnly,adLockReadOnly,adCmdText





If objRS.EOF and objRS.BOF then

' user combination does not exist

objRS.close

Set objRS = Nothing



Response.Write " Sorry, system couldn't let you login. Please reenter your

UserId and Password and try again!"



Else

'user exists

Rsponse.Redirect("bannernew.htm")



objRS.close

Set objRS = Nothing

End If



%>"



During this time no matter what UserId and Password I enter, and I always

got the same message " Sorry, system couldn't let you login. Please

reenter your UserId and Password and try again!". I have no idea WHY? Any

ideas?



Thanks



Wendy 

Message #6 by "Ken Schaefer" <ken@a...> on Fri, 22 Sep 2000 11:09:29 +1000
Suggest you do this:



Response.Write(strSQL)



and see what you are actually sending to your database.

Perhaps, due to other errors (eg spelling mistakes) you are sending values

to the database that result in no matching records being found...



Cheers

Ken



----- Original Message -----

From: <Wendy_wang@m...>

To: "ASP Databases" <asp_databases@p...>

Sent: Friday, September 22, 2000 4:58 AM

Subject: [asp_databases] RE: Error "Arguments are of the wrong type..."





> I appreciate everyone who gave your suggests. Now I got a big improvement.

>  The reason I need to use the conversion is because the data type of

> "strPasswordID = Request.Form("txtPassword")" is varchar and the data type

> of Password in Sysusers is varbinary.

>

> Now I am running the following:

>

> "<!--#Include File = "Adovbs.inc"-->

>

> <%

>

> strUserID = Request.Form("txtID")

> strPasswordID = Request.Form("txtPassword")

>

> strSQL = "SELECT * "

> strSQL = strSQL & "FROM SysUsers "

> strSQL = strSQL & "WHERE Name = '" & strUserID & "'"

> strSQL = strSQL & "AND Password = Convert(varbinary(256), '" &

> strPasswordID & "' )"

>

> strConnect = "Provider=SQLOLEDB.1;Persist Security Info=False;User

> ID=sa;Password = es; Initial Catalog=Serverinfo;Data Source=Mcfr1d07"

>

> Set objRS = Server.CreateObject("ADODB.Recordset")

> objRS.Open strSQL,strConnect,adOpenForwardOnly,adLockReadOnly,adCmdText

>

>

> If objRS.EOF and objRS.BOF then

> ' user combination does not exist

> objRS.close

> Set objRS = Nothing

>

> Response.Write " Sorry, system couldn't let you login. Please reenter your

> UserId and Password and try again!"

>

> Else

> 'user exists

> Rsponse.Redirect("bannernew.htm")

>

> objRS.close

> Set objRS = Nothing

> End If

>

> %>"

>

> During this time no matter what UserId and Password I enter, and I always

> got the same message " Sorry, system couldn't let you login. Please

> reenter your UserId and Password and try again!". I have no idea WHY? Any

> ideas?

>

> Thanks

>

> Wendy






  Return to Index