i hope this is the correct platform to ask this.
i am doing a c++ application that incorporates qmysql, i am using qt. i have two qline edit fields being name and password. after the user has entered these two i want to use them for login. i have this query
query.prepare("SELECT Type FROM users WHERE Name = "+loginName+" AND Password = "+ loginPassword);
where could my error be. it compiles but get an error that says
"incorrect syntax near 'AND password =
liphoso
0
Light Poster
Recommended Answers
Jump to PostIt's not a C++ error; it's an SQL error. Get the C++ to spit out the complete query being sent so you know for sure what it's sending, and then find the error in it.
Jump to PostI take it
loginName
andloginPassword
are string objects.string query = "SELECT Type FROM users WHERE Name = "+loginName+" AND Password = "+ loginPassword; cout << query;
All 6 Replies
Moschops
683
Practically a Master Poster
Featured Poster
liphoso
0
Light Poster
Moschops
683
Practically a Master Poster
Featured Poster
gusano79
247
Posting Shark
liphoso
0
Light Poster
gusano79
247
Posting Shark
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.