In vc ++ and MFC, when an SQL server statement is executed using ado and the true and false values of the returned values are determined, that is, the bool type, adobool

Source: Internet
Author: User

In vc ++ and MFC, when an SQL server statement is executed using ado and the true and false values of the returned values are determined, that is, the bool type, adobool

In mfc vc ++, You can query tables in the database to determine whether the SQL statement is successfully executed.

If the bool value is true (1), if the failure is returned, the bool value is 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 BOOL bool_temp = TheAdoData. executeSQL (_ bstr_t) SQL); // determines whether the previous SQL statement is successfully executed. If yes, true (1) is returned. If no, false (0) Result is returned. format ("% d", bool_temp); if (Result = '0') {MessageBox ("This table is not found in this database ");} else {MessageBox ("This table exists in this database ");}


===================================================== Welcome to raise a BUG ============ ==================================

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.