파일 다운로드!:: SQL_Lite.zip
CppSQLite3DB dbConnection;
try
{
dbConnection.open("UserList.db3");
int nRows = dbConnection.execDML("insert into userinfo values ('한효주', '한국');");
cout << nRows << " rows inserted" << endl;
CppSQLite3Query q = dbConnection.execQuery("select * from userinfo;");
for (int fld = 0; fld < q.numFields(); fld++)
{
cout << q.fieldName(fld) << "(" << q.fieldDataType(fld) << ")|";
}
cout << endl;
while (!q.eof())
{
cout << q.fieldValue(0) << "|";
cout << q.fieldValue(1) << "|" << endl;
q.nextRow();
}
nRows = dbConnection.execDML("delete from userinfo where user_name = '한효주';");
cout << nRows << " rows deleted" << endl;
}
catch (CppSQLite3Exception& e)
{
cerr << e.errorCode() << ":" << e.errorMessage() << endl;
}
[출처] SQLite 발만 담가보기|작성자 사랑한톨
'NativeCode > SQLite Cpp' 카테고리의 다른 글
SQL Query (0) | 2010.03.18 |
---|---|
SqlConnection (0) | 2010.03.18 |
SqlCommand (0) | 2010.03.18 |