John117 Posted July 23, 2007 Share Posted July 23, 2007 $sQuery = 'SELECT User_Name FROM Users WHERE User_Name="David"' Replace David with variable $UserName $sQuery = 'SELECT User_Name FROM Users WHERE User_Name= $UserName' -nope tried a few ways, none working Anyone spot my mistake? Link to comment Share on other sites More sharing options...
Developers Jos Posted July 23, 2007 Developers Share Posted July 23, 2007 $sQuery = 'SELECT User_Name FROM Users WHERE User_Name= ' & $UserName SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Monamo Posted July 23, 2007 Share Posted July 23, 2007 $sQuery = 'SELECT User_Name FROM Users WHERE User_Name=' & $UserName - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
John117 Posted July 23, 2007 Author Share Posted July 23, 2007 Thanks for the reply! I tried that one earlier, doesnt seem to like it. This is an SQL query if that helps . . . Link to comment Share on other sites More sharing options...
Monamo Posted July 23, 2007 Share Posted July 23, 2007 Is it possibly an issue with quotation marks? That is, considering the need for double ("") if you want the quotes to be passed as part of the string: $UserName = ""David"" - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
John117 Posted July 23, 2007 Author Share Posted July 23, 2007 error looks right but does not include " around the userid . . . could be causing it . . . how would you insert " around it """ will not insert the text " Link to comment Share on other sites More sharing options...
Developers Jos Posted July 23, 2007 Developers Share Posted July 23, 2007 when double quotes are needed just do: $sQuery = 'SELECT User_Name FROM Users WHERE User_Name="' & $UserName & '"' SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
John117 Posted July 23, 2007 Author Share Posted July 23, 2007 Solved . . . $sQuery = 'SELECT User_Name FROM Users WHERE User_Name=' & '"' & $UserName & '"' Thanks for the help! Link to comment Share on other sites More sharing options...
Monamo Posted July 23, 2007 Share Posted July 23, 2007 $UserName = '"David"' $sQuery = 'SELECT User_Name FROM Users WHERE User_Name=' & $UserName MsgBox(0,"",$sQuery) My mistake on the above entry, should have used single (') around the doubles(") - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
John117 Posted July 23, 2007 Author Share Posted July 23, 2007 $UserName = '"David"' $sQuery = 'SELECT User_Name FROM Users WHERE User_Name=' & $UserName MsgBox(0,"",$sQuery) My mistake on the above entry, should have used single (') around the doubles(") Thanks, works well Link to comment Share on other sites More sharing options...
weaponx Posted July 23, 2007 Share Posted July 23, 2007 To avoid confusion with quotation marks I like to use StringFormat $sQuery = StringFormat ( "SELECT User_Name FROM Users WHERE User_Name='%s'", $UserName) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now