我已经用C#和SQLite创建了一个简单的登录系统,这是我的第一个项目,所以忽略任何无知。当我使用调试模式时,程序完全可以工作,但是当我更改模式以释放时,它就会抛出这个错误。有人知道哪里出问题了吗?Image of the error thrown,image of the part of code that is throwing error。
编辑;完全错误
'************** Exception Text **************
code = Error (1), message = System.Data.SQLite.SQLiteException (0x800007BF): SQL logic error
no such table: staffLogin
at System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain)
at System.Data.SQLite.SQLiteCommand.BuildNextCommand()
at System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index)
at System.Data.SQLite.SQLiteDataReader.NextResult()
at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.SQLite.SQLiteCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at NEA_Example.LoginForm.loginButton_Click(Object sender, EventArgs e) in C:\Users\mwbel\OneDrive\Homework\A Level\Comp Science\NEA\NEA Example\NEA Example\LoginForm.cs:line 78
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)'发布于 2021-07-03 04:16:15
我已经解决了这个问题。连接字符串适用于调试版本,因为它位于调试目录中。我将conn字符串从;
SQLiteConnection techWorldConnection = new SQLiteConnection("Data Source=Login.db")转到;
SQLiteConnection techWorldConnection = new SQLiteConnection(@"Data Source=C:\Users\mwbel\OneDrive\Homework\A Level\Comp Science\NEA\NEA Example\NEA Example\bin\Debug\Login.db")现在,调试和发布版本可以与数据库通信。感谢大家的帮助。
https://stackoverflow.com/questions/68230228
复制相似问题