WHERE AND Clause in mySQL string

Discussion in 'C#' started by StealthRT, Jun 3, 2008.

  1. #1
    Hey all i am having trouble figuring out why this code does not seem to work:
    
    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
    
    Code (markup):
    I'm showing the values for the myEmail, myPass and myStore just fine... however i think its my query that's all screwed up....
    
    sqltemp="select * from fbusers where Email = '" & myEmail & " AND Company = " & myStore & "'"
    
    Code (markup):
    Any help would be great! :)

    David
     
    StealthRT, Jun 3, 2008 IP
  2. StealthRT

    StealthRT Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Solved:
    
    sqltemp="select * from fbusers where Email = '" & myEmail & "' AND Company = '" & myStore & "'"
    
    Code (markup):
    David
     
    StealthRT, Jun 3, 2008 IP
  3. rkstech

    rkstech Active Member

    Messages:
    195
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    73
    #3
    Ya Davids reply looks good
     
    rkstech, Jun 9, 2008 IP