Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dataset

Status
Not open for further replies.

teferi2002

Technical User
Sep 24, 2005
81
US
first off,I am just wondering if it is always the case to have the same name for datatable with
database table name.in my case datatable name is product and there is a table in the
database called products. what would happen if i give the dataTable a different name


second,can i construct a datatables from multiple database table for example select a, b, c
from a, b,c whre a=b and b=c something like this.

thanks



sub page_load
dim conNorhtwind as sqlConnection
dim daProducts as sqlDataAdapter

dtsProducts = new DataSet()


conNorthwind = new sqlConnection()
"server=localhost;database=Northwind;uid=sa;pwd=secrete")

dadProducts = new sqlDataAdapter("select top 10 * from products",conNorthwind)

dadProducts.fill(dstProducts,"products")
dgrdProducts.datasource=dstProducts


databind()
end sub
 
First of all, yes you can - it's irrelevant what ou want to call your DataTables.

Secondly, yes you can. If you fill each DataTable, you can create a relationship between each table as necessary.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Sorry, I thought your second query was about creating DataTables from different data sources not different tables within the same database. Yes, you can fill a DataTable using any SQL select statement regardless of how many tables it includes.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
thanks you ca8msm for clearing that up for me.I am not sure if i understood your second answer correctly.I migh not be clear with my question and this was what i would like to ask you..Can i create a dataTable by combining columns form different data base table.
 
Yes.. you can do that:
Ex:
Code:
Select a.ID,a.Name,b.Col1,b.Col2
From Table1 a
   Inner Join Table2 b ON
      a.ID = B.ID

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top