SQL Problem in C++ if

thnitos's Avatar, Join Date: Oct 2009
Light Poster
Hi there!
I have an EditBox and a database witch i rote in Microsoft SQL Server 2008.
I'm trying to check the text in the editbox with the database!
I'm doing this because i have form that checks username and password!
I've wrote this :
Code:
if (Edit1->Text == ADOQuery1->SQL->Text = "Select Username From UsrPass
                                                                     Where Username = 'name')
  {
    
  }
but it came out with an error
I apresiate any help!
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
What error?
Could it be anything to do with the fact that the string hasn't been terminated?
thnitos's Avatar, Join Date: Oct 2009
Light Poster
It points in hear about the error:
Code:
if (Edit1-Text == ADOQuery1->SQL_Text ="Select Username From UsrPass Where Username ='name'")
[BCC32 Error] Unit1.cpp(24): E2277 Lvalue required
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
The statement doesn't make sense, hence the error. But it's one of those statements where you can't tell what exactly is wrong without knowing what you're trying to do. So there's an if, but what are you comparing with what, and why is there an assignment in the middle of the expression?
thnitos's Avatar, Join Date: Oct 2009
Light Poster
I'm trying to compare the given username and password in the boxes with these in the database!
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
I would suggest reading the details from the database first, rather than trying to do it in one step.
Code:
ADOQuery1->SQL_Text="select..."
// execute the query
// fetch, say into variable x
if (Edit1->Text == x)
// etc