 |
| ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application . |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ADO.NET 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
|
|
|
|

July 20th, 2003, 08:48 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
Table name
when I use more than 1 select in sqlDataAdapter i get the table names as Table, Table1, Table2 & ...
Is it possible to name them or not?!?
Always:),
Hovik Melkomian.
__________________
Always,
Hovik Melkomian.
|
|

July 20th, 2003, 09:44 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Hovik,
Yes, you can change them. You could do this after the DataSet has been filled, like this:
Code:
MyDataSet.Tables(0).TableName = "MyFirstTable"
MyDataSet.Tables(1).TableName = "MySecondTable"
Alternatively, you can look at the TableMappings collection of the DataAdapter object. You can use the Add method to create a mapping between your default tables (table, table1 etc) and the names you want to give them. Look in the MSDN for more info.
HtH
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

July 20th, 2003, 09:48 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
Tnx Imar, one more thing: Can I do it in visual mode or not?!
Always:),
Hovik Melkomian.
|
|

July 20th, 2003, 10:05 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Yes, you can.
As soon as you have added a SqlDataAdapter to your form, you can click the three ellipses right after TableMappings in the Property Grid for the adapter. This will bring up the Table Mappings dialog.
In Source Table, you'll see the list of table names. In Dataset Table, you can change the names of the tables to the one you require in your application.
Now similar code is generated automatically by the Visual Designer (it's hidden in the Windows Form Designer generated code region).
HtH
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

July 20th, 2003, 10:17 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
thank u very much!!! let me work on & see the result, but I hope u wont be upset to see my third question witch I asked before but no 1 answered.
my problem is in DataRelation. I do one-to-many as well & have no problem, but the same way doesnt work for many-to-one & one-to-one Relations either. I hope u can help me to solve this one again;)
(if u can send me any link or example it'll be great help!!!)
Always:),
Hovik Melkomian.
|
|

July 20th, 2003, 10:23 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Which thread are you referring to? Can you post the address?
I don't know too much about the DataRelation designer, but we can always try..... ;)
Imar
Quote:
quote:Originally posted by melvik
<snip>I hope u wont be upset to see my third question witch I asked before but no 1 answered.
|
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
 |