Wrox Programmer Forums
|
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
 
Old July 20th, 2003, 08:48 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default 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.
 
Old July 20th, 2003, 09:44 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old July 20th, 2003, 09:48 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

Tnx Imar, one more thing: Can I do it in visual mode or not?!

Always:),
Hovik Melkomian.
 
Old July 20th, 2003, 10:05 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old July 20th, 2003, 10:17 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

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.
 
Old July 20th, 2003, 10:23 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
very urgent:cals table to indesign table using xsl franklinclinton XSLT 1 December 16th, 2009 03:48 PM
Populate a List Box with Table Names & Table date hewstone999 Access VBA 1 February 27th, 2008 10:10 AM
Sort Table Columns by Table Header Attribute omrieliav XSLT 4 June 7th, 2006 01:05 AM
(oracle 8i)Alter Table <table> coalesce partition combo Oracle 3 October 13th, 2004 09:35 AM
size of table (type table is table of number) MikoMax Oracle 1 November 19th, 2003 03:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.