cant save data to db

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm new to c#.
I am trying to insert or update data to my tables, and in the debug mode
everithig looks ok. when i exit and look in the database all the update or
insert did not take effect. i'm using Visual c# 2005 express and SQl 2005
express.
I tried to insert a button with this code :
private void Update_button_Click(object sender, EventArgs e)
{
dutyTBBindingSource.EndEdit();

dutyTBTableAdapter.Update(plugaDBDataSet.DutyTB);
}

thanks
Ilan
 
Hi Ilan,

How do you create the Update command for your DataAdapter? If you aren't
doing so, try using a CommandBuilder to create the insert, delete and
update commands.

using (SqlDataAdapter da = new SqlDataAdapter(insertCommand))
{
// command builder will add insert, update and delete
using (SqlCommandBuilder sb = new SqlCommandBuilder(da))
{
da.Fill(ds);
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top