MFC VC + + in the database to query the table to determine whether the SQL statement execution success
If there is a return bool value of TRUE (1), if the failure returns a bool value of FALSE (0).
The simple bool type code is as follows:
CString Sql,result;sql. Format (_t ("select * FROM [dbo].[ %s] "), name);//Name is the name of the table in the database that you want to find bool Bool_temp = Theadodata.executesql ((_bstr_t) SQL);//Determine if the previous SQL statement was executed successfully, Successful return True (1), no return False (0) Result.format ("%d", bool_temp), if (result== ' 0 ') {MessageBox ("This table is not in this database");} Else{messagebox ("There is this table in this database");}
=========================== Welcome to propose bug===============================
VC++,MFC, when executing SQL Server statements with ADO, and an example of whether the return value is true or FALSE, the bool type