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

Newbie! Not recognizing Text field from Database.

Status
Not open for further replies.

yryan

Programmer
May 10, 2002
15
CA
I am extremely new to ASP and have been given code to try and manipulate to do what it is supposed to be doing. A snippet of the code is below.

The following code was designed to be used with UserID as an assigned number. The UserID is supposed to be text. The information is coming from an Access Database. When I change the UserID field to text in the database the following code does not recognize it and returns an error. How do I change the following code to make it recognize the text field rather than a numerical field.

If szUserID <> &quot;&quot; And szPassword <> &quot;&quot; Then
Set db = Server.CreateObject(&quot;ADODB.Connection&quot;)
db.ConnectionString = &quot;Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Inetpub\Database\Books.mdb;&quot;
db.Open

Set rcUsers = db.Execute(&quot;SELECT * FROM OWNERS WHERE ID=&quot; & szUserID)
If rcUsers.BOF And rcUsers.EOF Then
Response.Redirect &quot;UserNotFound.htm&quot;
Else
rcUsers.MoveFirst
If StrComp(rcUsers.Fields(&quot;Password&quot;), szPassword, vbTextCompare) <> 0 Then
Response.Redirect &quot;BadPassword.htm&quot;
End If
End If
Else
bError = True
End If

Thanks for your help!%-)
 
Text and Date fields need ' ' around them. e.g.

...
WHERE ID='&quot; & szUserID) & &quot;'&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top