Hi, after extensive trawling of the internet I still havent found any solution for this problem.
I`m writing a small C++ app that connects to an online database and outputs the data in a listbox.
I need to enable a search function using an edit box, but I cant get the query to work while using a variable.
My code is:
res = mysql_perform_query (conn, "select distinct artist from Artists");
//res = mysql_perform_query (conn, "select album from Artists where artist = ' ' ");
while((row = mysql_fetch_row(res)) != NULL){
CString str;
UpdateData();
str = ("%s\n", row[0]);
UpdateData(FALSE);
m_list_control.AddString(str);
}
the first "res = " line is working fine, but I need the second one to work. I have a member variable m_search_edit set up for the edit box, but any way I try to include it in the sql statement causes errors.
eg.
res = mysql_perform_query (conn, "select album from Artists where artist = '"+m_search_edit+" ' ");
causes this error:
error C2664: 'mysql_perform_query' : cannot convert parameter 2 from 'class CString' to 'char *' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called"
And when I convert m_search_edit to a char* it gives me a " Cannot add 2 pointers" error.
Any way around this???