Subject: Dynamic tables in DataSet
Posted By: melvik Post Date: 9/16/2006 1:44:11 PM
Hi there:
Im working on an app what I need to read data from tables in my DB. but I dont know what tables will be read & I dont wanna create a dataSet filled by my all Tables in it.
in other way Im filling my dataset by unknowen tables & so I dont have DataTable names! when its filled & cuz I have no mapping its createing Table1, Table2, Table3, Table4, ...

any suggestion?! am I clear?!

Always,
Hovik Melkomian.
Reply By: Imar Reply Date: 9/16/2006 2:11:15 PM
??? Heuh? What are you talking about?

Can you please describe in lots more detail what you're trying to accomplish?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply By: melvik Reply Date: 9/20/2006 8:09:15 AM
ok sorry! u r right!
Well, I have a dynamic select in my Adapter & it select more than 1 table, like:
select * form mytb1; select * form mytb2; select * form mytb3; ...

so when this retrieve data into a DataSet, all r in Table1, Table2, Table3, ...

But I need to map them in mytb1, mytb2, mytb3 & ... (orginal table names in DB)
any way I can do it?!
I guess now Im clear.

Always,
Hovik Melkomian.
Reply By: Imar Reply Date: 9/20/2006 1:31:33 PM
Right, I see now.

You can rename them afterwards; however, I think you need to rename them yourself, as there is probably no way to derive the new name from the original query.

Why do you want to rename them?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply By: melvik Reply Date: 9/24/2006 7:58:41 AM
I export that filled dataset to a XML file.
u mean edit XML file?! or rename in DataSet?!
rename?! is it possible?! how?!

Always,
Hovik Melkomian.
Reply By: Imar Reply Date: 9/24/2006 2:39:22 PM
You can rename them by setting the TableName property:
myDataSet.Tables[0].TableName = "SomeName";
myDataSet.Tables[1].TableName = "SomeOtherName";

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply By: melvik Reply Date: 9/24/2006 11:55:05 PM
Oh yes dear I did it & works!
tnx so much

Now, in second part:
do u know an way to update this dataset to DB.
well, this is the story:
I made some XML file & sen dthem to ather branch, they will run a program to upload this datat in XML to their SQL Server. (both SQL Servers structure & Data r the same)
I need a dynamic DataAdapter, I was thinking about giving SELECT Comand & let it to create UPDATE, INSERT commands, what do u think?! any suggestion?

Tnx again

Always,
Hovik Melkomian.
Reply By: Imar Reply Date: 9/25/2006 1:24:17 AM
I think it's better to start a new topic for a new question. That makes it easier for everyone.

That said, can't you just Load the data into the DataSet using the Load method?

http://samples.gotdotnet.com/quickstart/howto/doc/Xml/LoadDataSetXMLData.aspx

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply By: melvik Reply Date: 9/26/2006 6:39:07 AM
ok & tnx Imar, let me try & then ...

Always,
Hovik Melkomian.
Reply By: melvik Reply Date: 9/26/2006 6:53:18 AM
oh no dear Imar, I know how to load my dataset with XML file.
ok lets make new topic

Always,
Hovik Melkomian.

Go to topic 49624

Return to index page 165
Return to index page 164
Return to index page 163
Return to index page 162
Return to index page 161
Return to index page 160
Return to index page 159
Return to index page 158
Return to index page 157
Return to index page 156