VC++,MFC, when executing SQL Server statements with ADO, and an example of whether the return value is true or FALSE, the bool type

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.