How do you write a SQL statement with text in vc. I tried [\"sometext\"], but this does not work.
Printable View
How do you write a SQL statement with text in vc. I tried [\"sometext\"], but this does not work.
I am a little confused as to what you are trying to do but here is a sample.
Hope it helps.
CString sqlWhere;
sqlWhere.Format("WHERE eip.[Institution] = %ld AND eip.[Type] = 'Reason' ", m_instID);
CDatabase* db;
// Get db from somewhere, e.g. db = new CDatabase; db->Open(...);
CString cCustName = "The Customer";
CString cSQL;
cSQL.Format( "INSERT INTO customers (NAME) VALUES( '%s' )", cCustName );
// Here you have the value:
// "INSERT INTO customers (NAME) VALUES( 'The Customer' )" in cSQL
db->Execute( cSQL );
I hope this helps.