Hello:

//rc = sqlite3_prepare(db, "select latitude, longitude from zip_code where country_id = ? and zip_code like ?", -1, &rowdata, 0);

After I bind a string of the form '6008%' to the ? with:

sqlite3_bind_text

and then execute sqlite3_step(rowdata), the sqlite3_step fails. Following is my code

rc = sqlite3_prepare(db, "select latitude, longitude from zip_code where country_id = ? and zip_code like ?", -1, &rowdata, 0);

rc = sqlite3_bind_text (rowdata,1, countryID->c_str(), countryID->Len(), SQLITE_STATIC);

zipCodeValue = wxString::Format(wxT("%s%s%s%s"),"'",zipCodeValue.c_str(), "%","'");

rc = sqlite3_bind_text (rowdata,2, zipCodeValue.c_str(), zipCodeValue.Len(), SQLITE_STATIC);

   if (rc == SQLITE_OK && rowdata != NULL )
   {
       int i = 0;
if (sqlite3_step(rowdata) == SQLITE_ROW)


I know that the zipCodeValue wxString is correct because I see it in the debugger. I go to the SQLlite command interpreter and run the same query and it works fine. When I change the 'like' to '=' and then just keep zipCodeValue as 60089, it works fine.

Is there a bug here, or am I binding incorrectly to ? when I want to use "like"?

Thanks,

Dan

Reply via email to