Hello, i want to update record ( based on condtion in sql query ) from DataGridView. i used the update method and i tried some code but it shows me below error on update method
OleDbCommand.Prepare method requires all parameters to have an explicitly set type.
OleDbDataAdapter da;
DataSet ds = null;
BindingSource bsource = new BindingSource();
public void BindData()
{
OleDbCommand cmd = new OleDbCommand("select srno,AccNumber,Admission_Fee,Family_fund,MonthlyCollection,MonthlyDeposit,Fund,SimpleLoanBal,SimpleInstallment,SimpleInt,UrgentLoanBal,UrgentInstallment,UrgentInt,EducationLoanBal,EducationInstallment,EducationInt,GuarantorInstallment,GuarantorInt,OtherLoanBal,OtherInstallment,OtherInt,BankLoanBal,BankInstallment,BankInt,TotalInstallment,OtherLoanCaption from transDemand where IssueDate=@IssueDate order by AccNumber Desc", con);
cmd.Parameters.AddWithValue("@IssueDate", datesearch.Value.ToString("dd-MM-yyyy"));
da = new OleDbDataAdapter(cmd);
ds = new DataSet();
OleDbCommandBuilder cmdbuild = new OleDbCommandBuilder(da);
da.Fill(ds, "transDemand");
bsource.DataSource = ds.Tables["transDemand"];
dataGridView1.DataSource = bsource;
private void btnupdate_Click(object sender, EventArgs e)
{
DataTable dt = ds.Tables["transDemand"];
this.dataGridView1.BindingContext[dt].EndCurrentEdit();
this.da.Update(dt);
BindData();
}