ADO.Net >> Fill Database Table with Sample data

by Q2hhbmRyYQ » Wed, 14 Jul 2004 22:08:01 GMT

I want to load some sample data for my nunit unit tests in the database.
And I want to do this by taking the data from a file, preferably an xml file that is generated by the command "SELECT * FROM SomeTbl FOR XML AUTO". I want to load this back to the table without much effort.
Is there a simple way of doing this?
Is there any adapter that lets me fill the database table using the xml file?

Thanks




ADO.Net >> Fill Database Table with Sample data

by Cor Ligthert » Wed, 14 Jul 2004 22:24:34 GMT


Hi Chandra,

I get the idea that you want to use the XML file to create your tables in
the dataset, if that is your goal, than you can not do that simple using a
program with a few commands.

However you can of course extract from your XML file the tables, the columns
and its types and than use a xxxCommands with "Create Table".

I hope this helps?

Cor

file that is generated by the command "SELECT * FROM SomeTbl FOR XML AUTO".
I want to load this back to the table without much effort.
file?

ADO.Net >> Fill Database Table with Sample data

by William Ryan eMVP » Thu, 15 Jul 2004 02:03:08 GMT

Is the data already in the db? You can just use an XMLTextReader/Writer
http://msmvps.com/williamryan/archive/2004/05/05/5912.aspx or you can also
use the Command's ExecuteXmlReader - I know this is general, but if you
could tell me a little more specifically about the scenario I could probably
be of more help.

--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups


file that is generated by the command "SELECT * FROM SomeTbl FOR XML AUTO".
I want to load this back to the table without much effort.
file?

ADO.Net >> Fill Database Table with Sample data

by William Ryan eMVP » Thu, 15 Jul 2004 08:54:51 GMT

Just create a DataAdapter and configure it with a valid Update command. You
can just call the .Update method (provided that your rowstate in the
datatable is modified,added, deleted)

--
W.G. Ryan MVP Windows - Embedded

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups


exact same schema as the XML. Now, I want to populate the database table
with the XML. How can I do this with the least amount of code. I do not have
strongly typed data sets for the table.

also
probably


database.
xml
AUTO".
xml

Similar Threads

1. how to verify the data set filling the right data table

Hi all,

I am now writing 1 stored procedure(sp) which execute 
other 2 sp, therefore result of 2 data set and 2 dataset 
tables.  But how can I ensure the right dataset filling 
the right tables so that .net crystal report can access 
the table's result to generate report.
Please help me, it drive me nearly crazy because I cannot 
generate the subreport.  Please help me.

P.S. I want 2 sp are independent for query.  But just have 
1 key of them can be joined.

Thanks and regards,
Hello

2. Looking for samples of parsing xml with linq dump to database table - CSharp/C#

3. Newbie question: Fill dataset will ALL tables from database

I am a C# developer in ADO.NET and need assistance with a I assume 
simple question:

How do I get all the data from a database in a dataset?  I want to be
able to open any kind of ODBC database and thus do not have any
knowledge of the names of the tables or fields contained in the
database.  I could after a day of searching on the Internet not find
ONE example where you don't have to specify which tables you want your
dataset to be populated with.

Thanks in advance