473,320 Members | 1,991 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.

Update From dataset to Database

Hi everybody,
I have a problem: I have a form and a DataGridView. I used DataAdapter
to get data from the DB. My source Db have two tables, and i use the
join the create e new tables in the dataset, then I load the dataset
into the datagrid. Now to upgrade the database directly from the
DataGrid what i have to do?

Thanks
Jan 5 '08 #1
2 1459
Your statment " i use the join the create e new tables" is misleading. If you
are using a JOIN clause, you are getting back one Datatable. Therefore, your
update, assuming you are passing this table into a DataAdapter, must have SQL
that is smart enough to know which columns belong to which of the original
joined tables and take care of updating each table.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"Baddy2009" wrote:
Hi everybody,
I have a problem: I have a form and a DataGridView. I used DataAdapter
to get data from the DB. My source Db have two tables, and i use the
join the create e new tables in the dataset, then I load the dataset
into the datagrid. Now to upgrade the database directly from the
DataGrid what i have to do?

Thanks
Jan 6 '08 #2
Baddy,

A Select with joined tables creates one resultset which is by you gotten as
I have read ir right using the Fill from the SqlDataAdapter.

There is no information from where the table comes, where the fields are
from, how much it is compressed etc etc.

The only possibility you have is to create your own Insert, Update and
Delete SQL scripts (sprocs or just as inline text in your DBlayer) and then
process those with seperate ADONet SqlClient.SQLExecuteNonQuery Commands.

Be aware that you have to do then yourself all concurency checking,
relational checing and act row by row what to do. In my idea a hell of a
job. I don't think that this is ever really done in a production
environment. For sure I have never seen samples about that in .Net
newsgroups.

For this kind of jobs are seperated Related DataTables used inside a DataSet
or whatever. (Aroud those are tools to create the needed Update, Delete, and
Insert scripts.). If it is about one none related sinlge datatable (not
joined) with less than 100 fields you can use as well then the
SqlClient.SqlCommandbuilder.

This is for versions before 2008, however I am me not aware that there has
changed anything about this in version 2008.

Cor

Jan 6 '08 #3

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

Similar topics

2
by: Niyazi | last post by:
Hi, I have not understand the problem. Before all the coding with few application everything worked perfectly. Now I am developing Cheque Writing application and when the cheque is clear the...
6
by: Babu Mannaravalappil | last post by:
Can somebody please help me figure out why the following method exceptions out? Execution at the line marked with ********** hangs for about 15 seconds and then I get an error that says an...
1
by: Mike Hnatt | last post by:
I'm baffled. My data store (database) is not updating with a refreshed dataset. Here's what is going on: 1) Create a dataset from a table in a database. 2) Create a copy of this dataset and...
1
by: Bennett Haselton | last post by:
Suppose I add a new row to a table in a dataset, and then I use an OleDbDataAdapter to add that new row to a SQL Server database using OleDbDataAdapter.Update(), as in the following code: ...
0
by: M. David Johnson | last post by:
I cannot get my OleDbDataAdapter to update my database table from my local dataset table. The Knowledge Base doesn't seem to help - see item 10 below. I have a Microsoft Access 2000 database...
0
by: Vijay Balki | last post by:
I am fetching data in DataSet - myDataSet, from a remote database using a Web Service in my VB.NET client..Once I fetch it I store the data in XML file (myXMLFile) using the WriteXML method of the...
7
by: Jean Christophe Avard | last post by:
Hi! I have a dataset that retreive all the item information from the database. I need to be able to edit them, in the dataset and in the database. I have this code, could anyone tell me if I'm...
5
by: PAUL | last post by:
Hello, I have 2 tables with a relationship set up in the dataset with vb ..net. I add a new record to the parent table then edit an existing child record to have the new parent ID. However when I...
8
by: Zorpiedoman | last post by:
I keep getting a concurrency exception the second time I make a change and attempt to update a dataadapter. It appears this is by design, so there must be something I can do to avoid it. ...
6
by: Tark Siala | last post by:
hi i'm using VS.NET 2005 +SP1 C#, and i connect access database by ADO.NET 2.0. i'm using Dataset to (insert,update,delete) and in get data i use (Datareader), but my problem when i do this: 1 -...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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: 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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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: 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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.