|
本帖最后由 hisumg 于 2010-10-7 23:01 编辑
我是在天嵌官方提供的步骤编译好了qtopia开发环境。
现在与数据库sqlite3连接出现了一个问题:
我在一个界面设置一个按钮b_ok,然后自定义了一个槽add_slot(),通过单击b_ok触发add_slot()建立数据库,编译通过,能够正常运行,可是当前目录下就是不能看到建立起来的数据库文件,
在此求救各位,不胜感激吖。。卡在这里两天了。
国际惯例,贴源码
槽的源码,以及connect函数
//The lines follow will add the Phone Num and the name to the DB when the b_OK is clicked.
connect(b_OK,SIGNAL(clicked()),this,SLOT(add_slot()));
}
void accountWin::add_slot()
{
//open the specified DB file,it will create a file for the name when the DB file is not exist.
rc=::sqlite3_open("GSM.db",&db);
if(rc==SQLITE_OK)
{
::sqlite3_exec(db,"CREATE TABLE account(index PRIMARY KEY,number VARCHAR(11),name VARCHAR(12));",0,0,&zErrMsg);
//sql="INSERT INTO account VALUES(4,13800138000,'fee');";
//::sqlite3_exec(db,sql,0,0,&zErrMsg);
QMessageBox::about(NULL,"About","open DB");
::sqlite3_close(db);
}
else
{
QMessageBox::warning(NULL,"warning","Can't open database!",QMessageBox::Yes|QMessageBox::No,QMessageBox::Yes);
//fprintf(stderr,"Can't open database:%s\n",sqlite3_errmsg(db));
::sqlite3_close(db);
}
}
PS:程序能够弹出message窗口,说明程序能够正确运行,可是就是不能生成所要的db文件,或者是生成在其他目录里,各位大大们能否说一下? |
|