473,320 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

cant save data to db

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

Oct 30 '06 #1
1 1401
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);
}
}
On Mon, 30 Oct 2006 11:26:01 +0100, Ilanco
<Il****@discussions.microsoft.comwrote:
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


--
Happy Coding!
Morten Wennevik [C# MVP]
Oct 30 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Andras Gilicz | last post by:
Hi VB fans I'm working on a relatively large project in VB6 with about a dozen forms, including graphs, labels, text boxes, etc. The software itself is actually a flow simulator with more or...
1
by: chuck amadi | last post by:
By the way list is there a better way than using the readlines() to > > >parse the mail data into a file , because Im using > > >email.message_from_file it returns > > >all the data i.e reads one...
16
by: Mike Fellows | last post by:
when i load my windows form i populate a combobox i use the code below Dim conn As New System.Data.SqlClient.SqlConnection(strConn) Dim sql As String = "AllLenders" Dim da As New...
10
by: Henok Girma | last post by:
Hello Gurus, I want to save the state of an unbound DataGridView on my Windows Form application to an XML file so i can later load it back.. Basically, on my form I have a DataGridView, it's got...
1
by: John | last post by:
Dear, We have 2 IIS server on win2000. we use the web server for upload file from server1 IIS to server2 IIS. We can connect from IIS1 to IIS2 success but the file unable to upload with below...
1
by: otupia | last post by:
Exercise : Given the diagram below. Transform the diagram into C++ program. Class Grade Private members :char letter;float score; Public Members :void SetScore( float );float GetScore(...
2
by: g35rider | last post by:
Hi, I have the following code that is giving this error, I cant simplify the code, I was just testing some theory for something we are doing and was getting an issue here. Please someone point out...
4
by: Bruce Skamser | last post by:
I added a field to a table and when I go to the form to add a textbox control, I can't bind it to the field in the table. It doesn't come up in the list of fields in the control source dropdown. ...
3
by: abie16 | last post by:
I'm creating a database for my company. Here we have errors form to calculate the errors done. The data entered in this form need to update into the errors table. This is my code but i'm getting...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.