int deleteRow()
{
int rollno;
cout << " 輸入學號 :" ;
cin >> rollno ;
if(cin.fail( ))
{
cin.clear( );
cout<<"學號格式錯了";
return 0;
}
std::stringstream strm;
strm << "delete from student " << " where roll=" << rollno ;
string s = strm.str();
char *str = &s[0];
//cout << str << endl;
sqlite3_stmt *statement;
int result;
char *query = str;
{
if(sqlite3_prepare(dbfile,query,-1,&statement,0)==SQLITE_OK)
{
int res=sqlite3_step(statement);
result=res;
sqlite3_finalize(statement);
}
return result;
}
return 0;
}
沒有留言:
張貼留言