问题描述
写了如下一小段程序,在wince下开发,用模拟器,运行的时候,提示SQLiteerror:nosuchtabletb_isbncj....望各位高手帮忙看一下usingSystem;usingSystem.Linq;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Data.SQLite;usingSystem.IO;usingSystem.Reflection;namespaceSmartDeviceProject2{publicpartialclassForm1:Form{publicForm1(){InitializeComponent();}publicstringconnstring="DataSource="+Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase)+"lsxhsd.db3";privatevoidbtnReset_Click(objectsender,EventArgse){//测试一下数据库通不通using(SQLiteConnectionconn=newSQLiteConnection(connstring)){try{conn.Open();MessageBox.Show("数据库能打开,成功"+conn.DataSource);}catch(Exception){MessageBox.Show("失败");}}}privatevoidtxtIsbn_KeyDown(objectsender,KeyEventArgse){if(e.KeyCode==Keys.Enter){txtSl.SelectAll();txtSl.Focus();}}privatevoidbtnAdd_Click(objectsender,EventArgse){if((txtIsbn.Text=="")||(txtSl.Text=="")){MessageBox.Show("书号或数量中任一项不能为空");return;}using(SQLiteConnectionconn=newSQLiteConnection(connstring)){conn.Open();SQLiteCommandcmd=conn.CreateCommand();cmd.CommandType=CommandType.Text;cmd.CommandText="insertinto[tb_isbncj](isbn,sl)values('safdsa',6)";//cmd.Parameters.Add(newSQLiteParameter("@isbn",txtIsbn.Text));//cmd.Parameters.Add(newSQLiteParameter("@sl",txtSl.Text));try{cmd.ExecuteNonQuery();MessageBox.Show("成功");}catch(Exceptionex){MessageBox.Show(ex.Message);}}}privatevoidtxtIsbn_TextChanged(objectsender,EventArgse){}privatevoidtxtCjh_KeyDown(objectsender,KeyEventArgse){if(e.KeyCode==Keys.Enter){txtCjh.Enabled=false;txtIsbn.Focus();}}}}
解决方案
解决方案二:
提示说没找到表:tabletb_isbncj
解决方案三:
引用1楼wyd1520的回复:
提示说没找到表:tabletb_isbncj
+12306
解决方案四:
nosuchtable英文看不懂?no没有such这么一个table表
解决方案五:
解决方案六:
缺文件,system.data.sqlite.dll复制,不能部署
解决方案七:
没有找到表啊