Data Table Question

fkheng

Well-known member
Joined
May 8, 2003
Messages
155
Location
Malaysia
If i fill a data set with data from an existing data source through a data adapter, with a table from a databsae, the table will be automatically created in the data set rite?

so do i still need to declare a data table instance to represent this table from my database?
 
NO you dont need to do that once you fill your dataset with some dataadapter it will automaticaly creates tables with in dataset and theri names are as like (table1), (table2) etc.

and if you want to show result in datagrid

just Datagrid.datasource = dataset.table("tabale1")
 
oh, u mean when the tables are automatically created, they are assigned with default names like table1 or table2, not the original table name as in the real database?

adapter.Fill(ds, "LoginTable")

when i use this command to fill a dataset, the second argument here has to be a data table object...wat do i write in here when i am filling from an existing data source and have no data table ob ject created?
 
If you specify the table name then it will create the table with that name and fill data in it returned from query.
as here

adapter.Fill(ds, "LoginTable")

it will create a logintable. if you dont specify any table

adapter.Fill(ds)

it must create a table just it will give it name Table1, its much better to always use a table Name.
 
Back
Top