MPKR
asked on
Howto SHOW Data on Windows Form?
Hi there,
I have tried for hours now. I am reading a MS Press book and understood what Dataset, Dataadapter, DAtatables... are.
But I can't manage to SHOW any Data stored on my SQL Server on my windows Form.
The Dataadapter fills my Dataset.
Dim ds As New DataSet
da_Asset.Fill(ds)
The Data is there, shown in the dataadapter Preview!
But what kind of control do I have to use for SHOWING that stuff to the user of my Form???? Is .NET that terribly complicated??
I have tried Dataviews or Datagrids but I can't realize it. The book does not help and I can't find just one simple example...!
MP
I have tried for hours now. I am reading a MS Press book and understood what Dataset, Dataadapter, DAtatables... are.
But I can't manage to SHOW any Data stored on my SQL Server on my windows Form.
The Dataadapter fills my Dataset.
Dim ds As New DataSet
da_Asset.Fill(ds)
The Data is there, shown in the dataadapter Preview!
But what kind of control do I have to use for SHOWING that stuff to the user of my Form???? Is .NET that terribly complicated??
I have tried Dataviews or Datagrids but I can't realize it. The book does not help and I can't find just one simple example...!
MP
Add datagrid to the form and then
Datagrid1.DataSource = da_Asset
that's all
Datagrid1.DataSource = da_Asset
that's all
ASKER
That doesn't work.
da_asset is an adapter in this case.
So far I feel I can pass only dataset.Tables(x) to Datagrids.Datasource. Right?
da_asset is an adapter in this case.
So far I feel I can pass only dataset.Tables(x) to Datagrids.Datasource. Right?
Sorry it must be dataset
Datagrid1.DataSource = ds
Datagrid1.DataSource = ds
ASKER
ok. Thanks. I am getting more and more certain.
One more question:
I have added some DataAdapters to my Form.
I have created a Dataset inside code while runtime.
I fill the Dataset with the Data from different Dataadapters while runtime like that:
da1.Fill(DSet)
datagrid1.DataSource = DSet.Tables(0)
'WORKS!
da2.Fill(DSet)
dgatagrid2.DataSource = DSet.Tables(1)
'WORKS!
da3.Fill(DSet)
'DSet.Tables.Add() <= that does work only if I add this Line!!??!! WHY?
datagrid3.DataSource = DSet.Tables(2)
Why does it work without adding a Table to the Dataset twice and does NOT work when adding a third Table?
Why must I add the third Table manually to the Dataset??
Thanks,
MP
One more question:
I have added some DataAdapters to my Form.
I have created a Dataset inside code while runtime.
I fill the Dataset with the Data from different Dataadapters while runtime like that:
da1.Fill(DSet)
datagrid1.DataSource = DSet.Tables(0)
'WORKS!
da2.Fill(DSet)
dgatagrid2.DataSource = DSet.Tables(1)
'WORKS!
da3.Fill(DSet)
'DSet.Tables.Add() <= that does work only if I add this Line!!??!! WHY?
datagrid3.DataSource = DSet.Tables(2)
Why does it work without adding a Table to the Dataset twice and does NOT work when adding a third Table?
Why must I add the third Table manually to the Dataset??
Thanks,
MP
Because probably initially you have only 2 tables in the dataset. When you adding the third table you can display it. How many datatables do you have in your dataset?
ASKER
Meanwhile I have added pu to 8 Tables because I want to show different data on 8 datagrids.
Do I really have to administrate those tables and their numbers.
For example when adding a new table (no 9) I have to
add a table
fill the table
And whenever I want to access this specific table I have to adress ds.tables(8) e.g. to print the data inside...
I know I could use names for my Tables, but that seems not to make it much easier.
Im I going a wrong way?
Do I really have to administrate those tables and their numbers.
For example when adding a new table (no 9) I have to
add a table
fill the table
And whenever I want to access this specific table I have to adress ds.tables(8) e.g. to print the data inside...
I know I could use names for my Tables, but that seems not to make it much easier.
Im I going a wrong way?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for your help!
Here is where I found good examples for getting started in VB.Net
.....http://msdn.microsoft.com/vbasic/downloads/samples/101samples.aspx
Link for ASP programs...
http://msdn.microsoft.com/asp.net/downloads/kits/default.aspx