من در هنگام اضافه کردن يک Row به تيبل و آپديت کردن اون، اين ارور رو ميگيرم:
Update requires a valid InsertCommand when passed DataRow collection with new rows.
کدي که در برنامه استفاده کردم هم اينه:
OleDbConnection cn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Persist Security Info=False; Data Source=" + Server.MapPath("db1.mdb"));
cn.Open();
OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM table1", cn);
DataSet ds = new DataSet();
da.Fill(ds);
DataTable table = ds.Tables[0];
DataRow row = table.NewRow();
row["UName"] = txtUName.Text;
row["Name"] = txtName.Text;
row["LName"] = txtLName.Text;
row["Email"] = txtEmail.Text;
row["Egold"] = txtEgold.Text;
row["Password"] = txtPass.Text;
table.Rows.Add(row);
da.Update(ds);
cn.Close();
آيا کسي ميدونه که ايراد اين برنامه چيه؟
ممنون ميشم اگه کمک کنيد.
Update requires a valid InsertCommand when passed DataRow collection with new rows.
کدي که در برنامه استفاده کردم هم اينه:
OleDbConnection cn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Persist Security Info=False; Data Source=" + Server.MapPath("db1.mdb"));
cn.Open();
OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM table1", cn);
DataSet ds = new DataSet();
da.Fill(ds);
DataTable table = ds.Tables[0];
DataRow row = table.NewRow();
row["UName"] = txtUName.Text;
row["Name"] = txtName.Text;
row["LName"] = txtLName.Text;
row["Email"] = txtEmail.Text;
row["Egold"] = txtEgold.Text;
row["Password"] = txtPass.Text;
table.Rows.Add(row);
da.Update(ds);
cn.Close();
آيا کسي ميدونه که ايراد اين برنامه چيه؟
ممنون ميشم اگه کمک کنيد.