Home All Groups Group Topic Archive Search About

Dataset from datasource returns no rows

Author
10 Jan 2007 11:59 PM
kwele
I set up a dataset from Add New Data Source ... on the Data Sources
tab. I selected two tables with a parent/child relationship.

The wizard created the .xsd file. I then dragged the parent datasource
over to the forms designer, where it created a bindingsource,
bindingnavigator and GridView.

This is the first time I've tried creating a dataset this way. Somehow
I assumed that it was doing all the coding, like creating the
dataadapter and filling the dataset.

When I ran the app, the counter on the bindingnavigator says "0 of 0".
I know there are 5 rows in the parent and 1 in the child.

What am I missing here?

TIA Kwele

Author
11 Jan 2007 10:32 AM
WenYuan Wang
Hi Kwele,
Thanks for your post.

According to your description, I understand that the bindingnavigator
control can not get records from database after you have dropped a
datasource to form designer.
If I misunderstand anything here, please don't hesitate to correct me.

Under my research, I find there is a tutorial about how to use
bindingnavigator control on MSDN website. Would you mind testing these
steps as this document mentioned to check whether or not it works for you?
http://msdn.microsoft.com/vstudio/tour/vs2005_guided_tour/vs2005pro/smart_cl
ient/BindingNavigator.htm
[Windows Forms - BindingNavigator]

By the way, as you have known, VS will do all the coding for us (such as
creating the dataadapter and filling the dataset) after we drop the
datasource to form designer.
For example:
private void Form2_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the
'testDataBase20060908DataSet.Terms' table. You can move, or remove it, as
needed.

this.termsTableAdapter.Fill(this.testDataBase20060908DataSet.Terms);
        }

We suggest you can open .cs file to check whether VS has added all these
codes for you when you drop the datasource to form.

If there is anything unclear, please feel free to reply me and we will
follow up. I'm glad to work with you.
Have a great day.
Wen Yuan
Microsoft Online Community Support
===============================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
===============================
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
11 Jan 2007 4:39 PM
Flomo Togba Kwele
Thanks for your reply, Wen.

I read the article you suggested. I did exactly what it said when
building the page originally.

I don't think the navigator is the problem. I don't think the
dataset.xsd file it created is filling the dataset from the
sqldataadapter, so that the navigator says there are no records in the
table, which is not true.

Do I have to code something in order for the dataset to be filled?

Thanks, Kwele

On Thu, 11 Jan 2007 10:32:26 GMT, v-wyw***@online.microsoft.com
(WenYuan Wang) wrote:

Show quote
>Hi Kwele,
>Thanks for your post.
>
>According to your description, I understand that the bindingnavigator
>control can not get records from database after you have dropped a
>datasource to form designer.
>If I misunderstand anything here, please don't hesitate to correct me.
>
>Under my research, I find there is a tutorial about how to use
>bindingnavigator control on MSDN website. Would you mind testing these
>steps as this document mentioned to check whether or not it works for you?
>http://msdn.microsoft.com/vstudio/tour/vs2005_guided_tour/vs2005pro/smart_cl
>ient/BindingNavigator.htm
>[Windows Forms - BindingNavigator]
>
>By the way, as you have known, VS will do all the coding for us (such as
>creating the dataadapter and filling the dataset) after we drop the
>datasource to form designer.
>For example:
>private void Form2_Load(object sender, EventArgs e)
>        {
>            // TODO: This line of code loads data into the
>'testDataBase20060908DataSet.Terms' table. You can move, or remove it, as
>needed.
>           
>this.termsTableAdapter.Fill(this.testDataBase20060908DataSet.Terms);
>        }
>
>We suggest you can open .cs file to check whether VS has added all these
>codes for you when you drop the datasource to form.
>
>If there is anything unclear, please feel free to reply me and we will
>follow up. I'm glad to work with you.
>Have a great day.
>Wen Yuan
>Microsoft Online Community Support
>===============================
>When responding to posts, please "Reply to Group" via your newsreader so
>that others may learn and benefit from your issue.
>===============================
>(This posting is provided "AS IS", with no warranties, and confers no
>rights.)
Author
12 Jan 2007 11:13 AM
WenYuan Wang
Hi Kwele,
Thanks for your reply.

Base on my experience, if we drop a datasource into Form designer. VS IDE
will create BindingNavigator, DataGridView, Dataset, BindingSource,
TableAdapter for us.
The following code will also be added in the Form_Load event.
This.TableAdapter.Fill(Dataset.Datatable);

TableAdapater will get all rows thru database and fill records into
dataset.datatable.

For these reason, we don't have to code anything.
If you want to check whether the dataset has been filled, we would like to
suggest you can check whether there is any code added in the Form_Load
event.
For example:
private void Form1_Load(object sender, EventArgs e)
        {

this.leasesTableAdapter.Fill(this.testDataBase20060908DataSet.Leases);
        }
Please check the above and let me know whether it is the root case.

If there is anything unclear, please feel free to reply me and we will
follow up.
I'm glad to work you.
Have a great weekend!
Wen Yuan
Microsoft Online Community Support
v-wyw***@microsoft.com

AddThis Social Bookmark Button