参数没有默认值,Excel C#

我的代码在下面有一些问题。 我想从datagridview插入WSID数据到我的excel文件。 当我运行时,我的commanddir2.ExecuteNoQuery()中有一个问题,它说参数@wsid没有默认值。 谁能帮我 ?

string koneksi = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Dokumen\Alfon\Kerja\BCA\Program\Program-Pengisian-Uang-ATM-BCA-SOY\Program-Pengisian-Uang-ATM-BCA-SOY\bin\x86\Debug\ATM SLA SURABAYA.xlsx;Extended Properties='Excel 12.0 xml;HDR=YES';"; private void InputScheduleSaldoBtn_Click(object sender, EventArgs e) { for (int i = 0; i < ViewDataSaldoGV.Rows.Count; i++ ) { OleDbConnection kon2 = new OleDbConnection(konekpengisian); OleDbCommand commanddir2 = kon2.CreateCommand(); commanddir2.CommandText = @"INSERT INTO [Saldo$] ([WSID]) VALUES (@wsid)"; commanddir2.Parameters.AddWithValue("@wsid", ViewDataSaldoGV.Rows[i].Cells["WSID"].Value); textBox1.Text = i.ToString(); kon2.Open(); commanddir2.ExecuteNonQuery(); kon2.Close(); } MessageBox.Show("Data berhasil disimpan"); } 

设置空值参数时设置DBNull

 commanddir2.Parameters.AddWithValue("@wsid", ViewDataSaldoGV.Rows[i].Cells["WSID"].Value)?? DBNull.Value;