 |
| C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 16th, 2006, 01:44 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
Dynamic tables in DataSet
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.
__________________
Always,
Hovik Melkomian.
|
|

September 16th, 2006, 02:11 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
??? 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.
|
|

September 20th, 2006, 08:09 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
ok sorry! u r right!
Well, I have a dynamic select in my Adapter & it select more than 1 table, like:
Code:
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.
|
|

September 20th, 2006, 01:31 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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.
|
|

September 24th, 2006, 07:58 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
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.
|
|

September 24th, 2006, 02:39 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You can rename them by setting the TableName property:
Code:
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.
|
|

September 24th, 2006, 11:55 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
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.
|
|

September 26th, 2006, 06:39 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
ok & tnx Imar, let me try & then ...
Always:),
Hovik Melkomian.
|
|

September 26th, 2006, 06:53 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
oh no dear Imar, I know how to load my dataset with XML file.
ok lets make new topic
Always:),
Hovik Melkomian.
|
|
 |