0
我試圖使用保存的WinForms輸入到Firebird數據庫下面的代碼火鳥插入數據,必須聲明命令參數
string connString = ConfigurationManager.AppSettings["ConnectionString"];
FbConnection fbConn = new FbConnection(connString);
fbConn.Open();
FbTransaction tran = fbConn.BeginTransaction();
try
{
string insertCmdStr = "INSERT INTO ARTICLES(ID,Group,Code,Name) ";
insertCmdStr += "VALUES(@id,@group,@code,@name)";
FbCommand addDataCmd = new FbCommand(insertCmdStr, fbConn, tran);
addDataCmd.ExecuteNonQuery();
}
catch (FbException ex)
{
tran.Rollback();
fbConn.Close();
throw new Exception(ex.Message);
}
tran.Commit();
fbConn.Close();
更是一分鐘後我收到以下錯誤(?):
必須聲明的命令參數