Hi,
I have this code where I add 20 parameters to the OleDbCommand but for some reason I only get 1 record inserted, why is this?
VB Code:
OleDbCommand dbcommand = new OleDbCommand(sql2, conn2); int Tablecount = 0; foreach (DataSet ds in TempDataSet) { //foreach (string s in TempColumnName) //{ string s = "@" + TempColumnName[Tablecount]; foreach (DataRow dr in ds.Tables[0].Rows) { //dbcommand.Parameters.Add(s, ds.Tables[0].Rows[ds.Tables[0].Rows.IndexOf(dr)][0]); dbcommand.Parameters.AddWithValue(s, ds.Tables[0].Rows[ds.Tables[0].Rows.IndexOf(dr)][0]); } //} Tablecount++; } dbcommand.ExecuteNonQuery();
Thanks Loftty,




Reply With Quote