If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > WHERE AND Clause in mySQL string

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-03-08, 14:29
StealthRT StealthRT is offline
Registered User
 
Join Date: Jul 2003
Posts: 45
Question WHERE AND Clause in mySQL string

Hey all i am having trouble figuring out why this code does not seem to work:
Code:
Set oConnection = Server.CreateObject("ADODB.Connection")
Set oRecordset = Server.CreateObject("ADODB.Recordset")

oConnection.Open "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=thesite.com; PORT=3306; DATABASE=dbname; USER=myuser; PASSWORD=thepass; OPTION=3;"	
	sqltemp="select * from fbusers where Email = '" & myEmail & " AND Company = " & myStore & "'"
		
	oRecordset.Open sqltemp, oConnection,3,3
	set rstemp = oRecordset

         If rstemp.eof then
		rstemp.close
		oConnection.close
		set rstemp = nothing
		set oConnection = nothing
		
		response.write myEmail & vbcr & myPass & vbcr & myStore & vbcr & "NO"
	else
		oRecordset.Close
		Set oRecordset = Nothing
		oConnection.close
		set oConnection = nothing
		
		response.write myEmail & vbcr & myPass & vbcr & myStore & vbcr & "YES"
	end if
I'm showing the values for the myEmail, myPass and myStore just fine... however i think its my query that's all screwed up....
Code:
sqltemp="select * from fbusers where Email = '" & myEmail & " AND Company = " & myStore & "'"
Any help would be great!

David
Reply With Quote
  #2 (permalink)  
Old 06-03-08, 16:10
StealthRT StealthRT is offline
Registered User
 
Join Date: Jul 2003
Posts: 45
Solved:
Code:
sqltemp="select * from fbusers where Email = '" & myEmail & "' AND Company = '" & myStore & "'"
David
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On