已存在数据库时打开 出错

这是wxWidgets论坛的中文版本。在这里,您可以用您的母语汉语讨论上面任一子论坛所涉及的所有关于wxWidgets的话题。欢迎大家参与到对有价值的帖子的中英互译工作中来!
Post Reply
love8gege
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Sep 01, 2017 12:47 pm

已存在数据库时打开 出错

Post by love8gege »

刚刚学习sqlite3 遇到这样的问题:

Code: Select all

const wxString dbFile = wxGetCwd() + "/test.db";

	m_textctrl->AppendText(dbFile);

	wxSQLite3Database db;

	if (wxSQLite3Database::HasEncryptionSupport())
	{
		db.Open(dbFile, wxString(wxT("password")));
		m_textctrl->AppendText("open db with password\n");
	}
	else
	{
		db.Open(dbFile);
		m_textctrl->AppendText("open db without password\n");

	} 
x64 debug编译正常 在运行时,第一次无问题,第二次也就是test.db存在时 就会出错
unhandled exception An unhandled exception occurred. 试着删除test.db,重新运行,又正常了,关键是我现在想学会后,在程序中打开我已建好的database ,请问,这个问题出在什么地方?
Last edited by doublemax on Fri Sep 01, 2017 12:57 pm, edited 1 time in total.
Reason: Added code tags
Post Reply