Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query help

Status
Not open for further replies.

heydyrtt

Programmer
Dec 12, 2001
63
US
I have lookupcombo which displays lastname and firstname, in this format smith,john. I need the query below to the return the results of the history of the name thats in the combobox. What I have doesn't work, works fine if I just go by lastname. can't get it to work off last and first tho. The database is MYSQL.

char Str[40];
DM->ResidentHistoryQ->SQL->Clear();
DM->ResidentHistoryQ->SQL->Add(" SELECT date_mail, last_name, first_name, reason_return ");
DM->ResidentHistoryQ->SQL->Add(" FROM mail ");
sprintf(Str, " WHERE last_name AND first_name = '%s'", txtName->Text.c_str());
DM->ResidentHistoryQ->SQL->Add(String(Str));
DM->ResidentHistoryQ->Open();

any suggestions

Heydyrtt
 
why dont you just use AnsiStrings in your program..
it probably wont change anything, but qry's use AnsiStrings
and they are easier to work with.
 
BorlandGeek AnsiString and String are the same.

An AnsiString is defined like this:

typedef AnsiString String;

so if u declare 2 identifiers like this

AnsiString MyIdentifier;
String MyIdentifier;
you'll get a multiple delcaration of identifiers.

--- LastCyborg ---
 
I was talking about the char str[40]; and the sprintf...
then turning the null terminated string into a String
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top