Dataset From Textfile question

  • Thread starter Thread starter Robert Porter
  • Start date Start date
R

Robert Porter

I have created at Dataset from an OleDB connected text file using schema.ini
and so forth, so far no problem, now what I need to do is take the data from
that dataset and update records in another database, (SQL Server) which has
a table that contains the same key as I used in the text file.

I have been able to walk through the first dataset and issue update commands
to the other database one at a time, but I can't help feeling there has to
be an easier way to do this.

I am trying to avoid walking through either the file with file IO commands
or the dataset one row at a time in favor of a batch operation. The data in
the text file will always be used to update records that exist in the target
SQL Server database, never to insert a new row.

Any suggestions? I am writing this as a Winforms app in VB.Net with 1.1
Framework.

Thanks in advance.

Bob Porter
 
Hi Robert,

I would in your situation not make a dataset from the textfile.

I would just read it using a streamreader, read it and then use the
SQLdatareader to do an update using an sqlcommand.exectutenonquery.

I am one of them who does everything with a dataset, but not this.

Just my thought,

Cor
 
Thanks for the reply.

I know I could do this, but I am working with a business object layer that
accepts datasets only, its for an enterprise app and there is no way I am
going to be able to change their infrastructure.

So, I need to know the best way to manage this in that environment. I have a
dataset that contains the data I need to use to update the target database,
but am not sure if there is a "new" way in ADO.NET to manage this since the
dataset can theoretically be connected to multiple datasources. But while
the structure is similar it is not the same.

What I would like to be able to do, and am not sure how, is create another
dataset that contains records that match the ones in the first dataset, then
update the new dataset, reconnect it and let it update the target database.

Any clues?

Cheers,

Bob
 
Back
Top