Re: commiting changes made to a typed dataset



dimitrisX wrote:
hello,
i am writing an app in c# which reads data from Excel files and
submits them to an sqlserver database. the db is not going to be
modified by others during the excecution of the program. also the db
has many tables with complex relations.

1. i created a typed dataset of the datasource
2. the data read from an excel file are being inserted as new rows in
corresponding tables of the dataset
3. finally all the added rows have to be submitted to the datasource

the problem is i can't figure out how to do step 3: submit the changes
to the datasource. i thought there should be a way of synchronising
the dataset with the datasource in one move and in one place (i.e.
main() ). is that possible??


I'm confused: is the datasource of the dataset the Excel file or the sql
server database? Anyways ...
A quick read of the documentation at
http://msdn2.microsoft.com/en-us/library/system.data.dataset.aspx reveals
this statement:
4. Call the Update method of the DataAdapter, passing the second DataSet as
an argument.

So it appears you have to use a DataAdapter to update the database. If you
need to follow up on this:

There was no way for you to know it (except maybe by browsing through some
of the previous questions in this newsgroup before posting yours - always a
recommended practice) , but this is a classic ADO newsgroup. ADO.Net bears
very little resemblance to classic ADO so, while you may be lucky enough to
find a dotnet-knowledgeable person here who can answer your question, you
can eliminate the luck factor by posting your question to a group where
those dotnet-knowledgeable people hang out. I suggest
microsoft.public.dotnet.framework.adonet.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


.



Relevant Pages

  • Re: Data sources for different mailmerge letters
    ... Please reply to the newsgroup unless you wish to avail yourself of my ... and inserting them into an existing database, however, when I finish that, ... the datasource will not allow me edit the mailmerge recipients, ... data to show up in the mailmerge letter. ...
    (microsoft.public.word.mailmerge.fields)
  • Re: automatically closing Access datasource after Word merge
    ... > Database. ... > database opens. ... > a) closes the datasource after merge (the datasource is Access not ... reply in the newsgroup and not by e-mail :-) ...
    (microsoft.public.word.vba.customization)
  • Re: OpenDataSource Was Working, Now Isnt
    ... > filename to the Excel file. ... or sometimes a subdirectory named DataSource.) ... and won't even know which kind of connection method ... This reply is posted in the Newsgroup; ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Discovering current datasource
    ... > The document is in desperate need of modernisation(as is the database), ... > where it is so old, no-one can tell me where the datasource is actually held. ... Drill down the Office applications tree, to Word, ... This reply is posted in the Newsgroup; please post any follow question or reply ...
    (microsoft.public.word.mailmerge.fields)
  • Re: display excel data on dynamic wep page
    ... To find the best Newsgroup for FrontPage support see: ... | Is it possible to use an Excel file as a datasource on a dynamic webpage? ...
    (microsoft.public.frontpage.programming)