Trying to load a dataset

  • Thread starter Thread starter jaime
  • Start date Start date
J

jaime

1 I load a text file into a dataset, after doing a bit of work..
2 Now I have a dataset full of data that I like to transfer to a data base
3 My problem is that if the rowstate of the row is set to unchange, nothing
happen!! :( ;
4 Is it posible to load / change this parameter to read Added?
5 Am I doing something wrong / is there another way of transfering a dataset
to a database, appart from saving to xml then load it to the db?

Thanks for any help

jaime
 
Jamie,

When importing your data, you can read the dataset in, but then you will
have to create a copy and then copy the rows over to the new data set. The
reason for this is because you can not change the RowState property (which
would be very, very helpful, I agree).

Then, perform your processing and then insert into the database.

Hope this helps.
 
Nicholas said:
Jamie,

When importing your data, you can read the dataset in, but then you will
have to create a copy and then copy the rows over to the new data set. The
reason for this is because you can not change the RowState property (which
would be very, very helpful, I agree).

Then, perform your processing and then insert into the database.

Hope this helps.

Sorry for intrusion and tiny knowledge, but how can a text file be
loaded into a DataSet? If it is done throught DataAdapter then you may
use it's property AcceptChangesDuringFill. Mybe there is some other
means (excluding, of course, hand-adding, wich does not produce such
problems) to load a text file?

Dmitry.
 
Dmitry,

The original poster probably used the WriteXml method on the DataSet to
write to a stream (a FileStream probably) which is then persisted to disk.
Later, the stream can be opened and read through the ReadXml method.

Also, the ReadXml and WriteXml methods take a filename argument which
will get the contents that have been persisted to a file.
 
Dimitry,
Sorry didn't replay before.
I usually load file to SqlServer then work with then there or on the way
to it's final destination.
To check if the dataset is empty you could see the row count of the
first table, check the RowState and use the adaptor, this will only work
with rows that have this state to something different to Unchange.
I am loading a text file to a dataset then this dataset can be save to
sqlServer, if you need help on this let me know and I'll send some
samples.
But have a look at this utility from Microsoft
http://msdn.microsoft.com/vcsharp/downloads/components/default.aspx?pull
=/library/en-us/dnbda/html/daab-rm.asp
It may explain some of the staff you want.
 
Back
Top