【发布时间】:2020-06-07 10:06:39
【问题描述】:
我正在尝试存储用户输入的信息(如注册),但我收到一条错误消息:
SQLiteException 未处理
System.Data.SQLite.dll 中出现“System.Data.SQLite.SQLiteException”类型的未处理异常
附加信息:未知错误
提供给命令的参数不足
代码:
var command = "insert into Reports(sReportNo, sReportDate) values(@ReportNo, @ReportDate)";
using (IDbConnection = new SQLiteConnection connection =
new SQLiteConnection(@"Data Source=.\T.Server.db;Initial Catalog=Reports;Version=3;"))
{
try
{
connection.Execute(command, new
{
sReportNo = ReportNo,
sReportDate = ReportDate
});
MessageBox.Show(successful);
}
catch
{
MessageBox(unsuccessful);
}
Reset();
【问题讨论】:
-
表中还有其他字段吗?哪些是强制性的?
-
@viveknuna - 我正在使用 SQLite DB 浏览器,那里的代码是:CREATE TABLE "Reports" ("sReportNo" TEXT, "sReportDate" TEXT);