Data Base problem
-
Hi, I'm trying to create a new row and add values to the column in the below code. But it throws exception called "Update unable to find data table 'Table' or Tablemapping 'table' ". DataSet dset = new DataSet(); SqlCommand dbcommand = new SqlCommand(); dbcommand.CommandText ="select * from DBTable"; dbcommand.Connection = myConnection; SqlDataAdapter dbDA = new SqlDataAdapter(dbcommand); dbDA.Fill(dset, "DBTable"); DataTable dbtable = dset.Tables[0]; // dset.Tables.Add(dbtable); DataRow row; row = dbtable.NewRow(); row["Name"] = DBfile; row["Meters"] = IMeter; dbtable.Rows.Add(row); dbDA.Update(dset); any solution? or let me know how to create a new row and assign values to the columns.
-
Hi, I'm trying to create a new row and add values to the column in the below code. But it throws exception called "Update unable to find data table 'Table' or Tablemapping 'table' ". DataSet dset = new DataSet(); SqlCommand dbcommand = new SqlCommand(); dbcommand.CommandText ="select * from DBTable"; dbcommand.Connection = myConnection; SqlDataAdapter dbDA = new SqlDataAdapter(dbcommand); dbDA.Fill(dset, "DBTable"); DataTable dbtable = dset.Tables[0]; // dset.Tables.Add(dbtable); DataRow row; row = dbtable.NewRow(); row["Name"] = DBfile; row["Meters"] = IMeter; dbtable.Rows.Add(row); dbDA.Update(dset); any solution? or let me know how to create a new row and assign values to the columns.
It had happend to me some times ago. I used mapping table name as "Table" then it was sorted. when you query then it doesn't understand or pick the table name. it might help you also. Naveed Kamboh
-
It had happend to me some times ago. I used mapping table name as "Table" then it was sorted. when you query then it doesn't understand or pick the table name. it might help you also. Naveed Kamboh
sorry !! Plz can you tell me in the code where and what i have to change? The problem is i'm new to c# .
-
Hi, I'm trying to create a new row and add values to the column in the below code. But it throws exception called "Update unable to find data table 'Table' or Tablemapping 'table' ". DataSet dset = new DataSet(); SqlCommand dbcommand = new SqlCommand(); dbcommand.CommandText ="select * from DBTable"; dbcommand.Connection = myConnection; SqlDataAdapter dbDA = new SqlDataAdapter(dbcommand); dbDA.Fill(dset, "DBTable"); DataTable dbtable = dset.Tables[0]; // dset.Tables.Add(dbtable); DataRow row; row = dbtable.NewRow(); row["Name"] = DBfile; row["Meters"] = IMeter; dbtable.Rows.Add(row); dbDA.Update(dset); any solution? or let me know how to create a new row and assign values to the columns.
check the following article. http://www.codeproject.com/cs/database/sqldawithoutsqlcb.asp hope this would solve the problem. Saqib