Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / January 2008

Tip: Looking for answers? Try searching our database.

Update From dataset to Database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Baddy2009 - 05 Jan 2008 18:02 GMT
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
Peter Bromberg [C# MVP] - 06 Jan 2008 01:18 GMT
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 

> Hi everybody,
> I have a problem: I have a form and a DataGridView. I used DataAdapter
[quoted text clipped - 4 lines]
>
> Thanks
Cor Ligthert[MVP] - 06 Jan 2008 08:44 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.