首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我的C# Windows窗体的发布版本无法连接到System.Data.SQLite

我的C# Windows窗体的发布版本无法连接到System.Data.SQLite
EN

Stack Overflow用户
提问于 2021-07-03 03:06:29
回答 2查看 61关注 0票数 0

我已经用C#和SQLite创建了一个简单的登录系统,这是我的第一个项目,所以忽略任何无知。当我使用调试模式时,程序完全可以工作,但是当我更改模式以释放时,它就会抛出这个错误。有人知道哪里出问题了吗?Image of the error thrownimage of the part of code that is throwing error

编辑;完全错误

代码语言:javascript
复制
'************** 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)'
EN

Stack Overflow用户

发布于 2021-07-03 04:16:15

我已经解决了这个问题。连接字符串适用于调试版本,因为它位于调试目录中。我将conn字符串从;

代码语言:javascript
复制
SQLiteConnection techWorldConnection = new SQLiteConnection("Data Source=Login.db")

转到;

代码语言:javascript
复制
SQLiteConnection techWorldConnection = new SQLiteConnection(@"Data Source=C:\Users\mwbel\OneDrive\Homework\A Level\Comp Science\NEA\NEA Example\NEA Example\bin\Debug\Login.db")

现在,调试和发布版本可以与数据库通信。感谢大家的帮助。

票数 0
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68230228

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档