Use custom class CSETODBC (3)

xiaoxiao2021-03-06  142

1. Use the SQL word sentence to theory any database, use SQL as an example. 2, use method void ctestodbdlg :: onusesql () {csetoDBC DLG; DLG.SetFileName ("f: //setodbc.con"); dlg.SetAppname ("TEST"); const cstring strconnect = DLG.GetConnectStr (); // Get the connection string cstring strsql; cdatabase db; db.openex (strConnect); // Open the database {// Add record strsql = "Insert Into Character Name, Country, AGE) VALUES (/ 'HE /', / 'CHINA /', 24) "; DB.ExecuteSQL (STRSQL);} {// Remove STRSQL.FORMAT (" Delete from Character Where Age =% D ", 24); db.executesql (strsql);} {// modified record strsql.format (" Update Character Set Age = 25 Where name = /'HE/'"" "db.executesql(STRSQL ); }// Display all records {CSTRING STROUTPUT; CRECORDSET RS (& DB); rs.open (CRecordset :: Snapshot, "Select * from Character"); int nfield = rs.getodbcfieldcount (); while (! Rs.iseof ()) {for (INT i = 0; I

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

New Post(0)