D
Douglas Buchanan
I created an untyped dataset using the tables collection editor and
the columns collection editor.
The table was the employee table from the pubs database which has the
following eight (8) fields
emp_id
fname
minit
lname
job_id
job_lvl
pub_id
hire_date
For the table collection I supplied "employee" for both the
'TableName' and the '(Name)'
For the columns collection I added the following (7) members:
Important note: I did not add eight (8)! I did not add 'pub_id'!
emp_id
fname
minit
lname
job_id
job_lvl
hire_date
However, when the datagrid is populated I get eight (8) fields!
The field 'pub_id' is shown as the last column. Is there something I
don't understand about fileds returned in a dataset? Why am I getting
more than I ask for?
Here is my code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.SqlDataAdapter1.Fill(dsEmployee, "employee")
Me.DataGrid1.SetDataBinding(dsEmployee, "employee")
End Sub
1.) Why does this happen?
======================
As an additional note. If I remove addtional fields from the column
collection, they too still are shown in the datagrid. All columns not
defined show up after those defined.
(What if someone really wants a subset of rows? What do they do?)
the columns collection editor.
The table was the employee table from the pubs database which has the
following eight (8) fields
emp_id
fname
minit
lname
job_id
job_lvl
pub_id
hire_date
For the table collection I supplied "employee" for both the
'TableName' and the '(Name)'
For the columns collection I added the following (7) members:
Important note: I did not add eight (8)! I did not add 'pub_id'!
emp_id
fname
minit
lname
job_id
job_lvl
hire_date
However, when the datagrid is populated I get eight (8) fields!
The field 'pub_id' is shown as the last column. Is there something I
don't understand about fileds returned in a dataset? Why am I getting
more than I ask for?
Here is my code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.SqlDataAdapter1.Fill(dsEmployee, "employee")
Me.DataGrid1.SetDataBinding(dsEmployee, "employee")
End Sub
1.) Why does this happen?
======================
As an additional note. If I remove addtional fields from the column
collection, they too still are shown in the datagrid. All columns not
defined show up after those defined.
(What if someone really wants a subset of rows? What do they do?)