Another way to insert data into the database is inserted according to the size of the ID number.

xiaoxiao2021-03-06  66

// Todo: Add extra validation here

Updatedata (TRUE);

CString strsql;

// CRESOURESET M_RECORDSET (& M_Database);

INT i = 1;

INT FLAG = 0;

While (! flag) {

Cbookset M_Recordset (& M_Database);

strsql.format ("SELECT * from Book Where Book_ID =% D", I);

m_recordset.open (AFX_DB_USE_DEFAULT_TYPE, STRSQL);

IF (m_recordset.getRecordcount () == 0) {

Strsql.Format ("INSERT INTO BOOK VALUES (% D, / '% S /', / '% S /',% D,% D,% D,% F)", I, M_Name, M_AUTHOR, 0, M_COURSEID , m_quantity, m_price;

M_Database.executesql (strsql);

m_database.close ();

CDIALOG :: Onok ();

FLAG = 1;

}

i ;

//m_recordset.delete ();

转载请注明原文地址:https://www.9cbs.com/read-119720.html

New Post(0)