Click here to Skip to main content
15,901,426 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to add a where statemnet to this without much luck. Any help is appreciated. Thank you.

C++
SQLCHAR* query = (SQLCHAR*)"SELECT tblIP.[IPAddress], tblIP.[IPType], tblIP.[IPStatus], tblIP.[IPMax] FROM tblIP ORDER BY tblIP.[IPAddress] ASC;";


Tried this...
C++
SQLCHAR* query = (SQLCHAR*)"SELECT tblIP.[IPAddress], tblIP.[IPType], tblIP.[IPStatus], tblIP.[IPMax] FROM tblIP WHERE tblIP.[IPAddress]='173.201.216.2' AND tblIP.[IPType]='3' AND tblIP.[IPStatus]='1' AND tblIP.[IPMax]='0';";


IPAddress is a text field
IPType is a number field
IPStatus is a number field
IPMax is a number field
Posted
Updated 18-Oct-11 18:55pm
v2

This works........

C++
SQLCHAR* query = (SQLCHAR*)"SELECT tblIP.[IPAddress], tblIP.[IPType], tblIP.[IPStatus], tblIP.[IPMax] FROM tblIP WHERE tblIP.[IPAddress]='173.201.216.2' AND tblIP.[IPType]=3 AND tblIP.[IPStatus]=1 AND tblIP.[IPMax]=0;";
 
Share this answer
 
Comments
[no name] 19-Oct-11 2:04am    
Good, finally you find its solution
Remove the single quotes around the number field values.
 
Share this answer
 
Comments
Member 7766180 19-Oct-11 1:16am    
Thank you. I did that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900