Hi
I am trying to insert data into a sql server database table using sqlDataAdapter and adding newrow method.But the values entered are not saved in the database.What I did is............
string sql = "Select * from Users";
dataCmd.CommandText = sql;
SqlDataAdapter da = new SqlDataAdapter(dataCmd);
da.SelectCommand = new SqlCommand(sql, cn);
da.SelectCommand.ExecuteNonQuery();
DataTable UserTable = new DataTable();
da.Fill(UserTable);
DataRow dtr;
dtr = UserTable.NewRow();
dtr["UserID"] = txtID.Text;
dtr["User_Name"] = txtName.Text;
UserTable.Rows.Add(dtr);
MessageBox.Show("Row Inserted");
this.usersTableAdapter1.Fill(this.testDataSet.Users);
What has gone wrong here?????
Or can you help me to solve this???
Thanks a lot..