473,383 Members | 1,855 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,383 software developers and data experts.

C# data commit question

69
Hello all...

I know this is probably very easy and I'm just missing it... but I've been trying to learn C# on my own at work and this problem has me stumped.

I am able to connect to my SQL database and view data with no problem.

As an example I created a datagrid view on a form that shows some data from a table.

What I want to do is allow the user to change data and have that data change committed to the database. As it is the user can change data, but it's never actually committed to the database.

I've read all over the place trying to figure this out... and I'm sure it's easy...

Can anyone help me with how to save changes to the SQL database that are made in a datagrid view on a form?

Thanks!
Nov 13 '07 #1
4 2293
r035198x
13,262 8TB
Hello all...

I know this is probably very easy and I'm just missing it... but I've been trying to learn C# on my own at work and this problem has me stumped.

I am able to connect to my SQL database and view data with no problem.

As an example I created a datagrid view on a form that shows some data from a table.

What I want to do is allow the user to change data and have that data change committed to the database. As it is the user can change data, but it's never actually committed to the database.

I've read all over the place trying to figure this out... and I'm sure it's easy...

Can anyone help me with how to save changes to the SQL database that are made in a datagrid view on a form?

Thanks!
Perhaps if you post the code that's not working ...
Nov 13 '07 #2
Plater
7,872 Expert 4TB
You would need to use an Update command. However, we would probably need to see the situation you are in order to suggest anything further. (Manual use vs automated from a dataset)
Nov 13 '07 #3
narpet
69
There's really no code to show at this point...

The entire form was created using MS Visual Dev Studio... so it generated all the code for me.

I'm using a defined dataset, and for the datagrid view I'm using a defined table adapter. So it is all auto created.

I hope this info helps...

we can just call the datagrid... datagridview1
call the dataset... dataset1
call the table adapter... adapter1
call the binding source... bind1

Like I said... this is all new to me... but I've been able to fill data views, filter those views... just about anything that doesn't actually change the actual database. But that's what I need to do the most (of course).

Any ideas??
Nov 13 '07 #4
Plater
7,872 Expert 4TB
I believe you can use the designer to create UpdateCommand (although if it goes on the dataset or the datagridview I dunno, I've only seen people talk about it), just to do a quick google/msdn search for it?
Nov 13 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Markus Breuer | last post by:
I have a question about oracle commit and transactions. Following scenario: Process A performs a single sql-INSERT into a table and commits the transaction. Then he informs process B (ipc) to...
4
by: chris | last post by:
I open MySQL Manager and connect to my database. I then insert one record in to an InnoDB table in MySQL (4.0 and 4.1 alpha hosted on XP running mysqld --console). I then retrieve the record...
1
by: M Wells | last post by:
Hi All, Further to my previous long-winded question about a situation in which we appear to be mysteriously losing data from our mssql2k server. We discovered an update statement, in the...
8
by: Martin Staael | last post by:
When doing a UPDATE on a very large table it can take quite a long time due to the commit/rollback option. Is there any way on the client side to disable the commit/rollback option so that UPDATE...
2
by: janet | last post by:
HI, I had a question on auto-commit in DB2 EEE V8 on AIX V5. Here is my example.. there are two script A.sh , B.SQL A.sh is following:
30
by: Charles Law | last post by:
Here's one that should probably have the sub-heading "I'm sure I asked this once before, but ...". Two users are both looking at the same data, from a database. One user changes the data and...
9
by: Anurag | last post by:
ENVIRONMENT: ============ (1) AIX 5.2 ML 8 and AIX 5.3 TL 4. (2) DB2 ESE on some servers and DB2 Connect Enterprise Edition on others. QUESTION: ========= I upgrade DB2 on some 15 Production...
7
by: Igor | last post by:
1. In this topic...
10
by: pbd22 | last post by:
Hi. Like the title says - how do i do this? I was given the following example: INSERT INTO TABLE2 SELECT * FROM TABLE1 WHERE COL1 = 'A' The above statement threw the following error:
10
by: giraffeboy | last post by:
Hi there, I'm having a problem with the Python db api, using MySQL. I've written a program with a GUI using wxPython, the GUI is contained in main.py which imports another module - reports.py....
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.