此代码生成空引用异常。异常出现在初始化参数数组的行。可能是什么问题?我不知道如何跟踪堆栈跟踪并对其进行任何逻辑处理。提前致谢。
DAL dal = new DAL();
string SQL = @"INSERT INTO Assets ([AssetName],[AssetType],[Model],[Description],
[PurchaseValue],[SalvageValue],[Currency],[DateAcquired,[DateRetire],[ImagePath],
[InUse])
VALUES (?,?,?,?,?,?,?,?,?,?,?)";
OleDbParameter[] par = new OleDbParameter[]{
new OleDbParameter("@assetname",name.Text),
new OleDbParameter("@assettype",assettypes.SelectedValue.ToString()),
new OleDbParameter("@model",model.Text),
new OleDbParameter("@description",description.Text),
new OleDbParameter("@purchasevalue",purchaseval.Value),
new OleDbParameter("@salvagevalue",salvageval.Value),
new OleDbParameter("@currency",currencies.SelectedIndex),
new OleDbParameter("@dateacquired",purchasedate.Value),
new OleDbParameter("@dateretire",purchasedate.Value.AddYears((int)lifetime.Value)),
new OleDbParameter("@imagepath","N/A"),
new OleDbParameter("@addedby",MDIParent1.User.ID)
};