R
Reney
I haven't used the VS Studio's drag&drop method to create my connection,
adapters and datasets, but I typed them all. The situation is like this:
There is a listbox with members pulled from the database.(I am using an
access db). The user selects one value from the listbox and clicks on one of
two buttons "ThisWeek" or "LastWeek". The button click events each has its
own SQL statement, pulling datarows from two different tables in the
database(they are related with "employeeID", which is selected in the
listbox I told before). Then the data adapter fills the dataset and it's
connected to one datagrid. The datagrid shows the values if the click event
completes successfully. But as I say, all the database connection, filling
and close processes are done in the click event.
The problem starts right after that. The user has the choice to modify the
dataset using the datagrid. And to update, he has to click on the "Update"
button in the form. But I don't kow how to make the update in antoher click
event. Since the datasets are created and tied to the grid in a different
click event. Now in another click event, the dataset is not recognized. So I
have to fill a new dataset, but this time, how is it going to recognize the
changes made to the dataset.
I am not very familiar with datagrids and datasets, so the topic is a little
bit out of my scope. After I looked through the Internet and forums, in all
the similar problems, they have a common thing that, they were filling the
dataset in the form_load events with simple sql statements. In my case, the
sql statement is dynamically changing with the value selected in a listbox
and the button pressed(Remember two buttons, "thisweek" and "lastweek"). And
the dataset is filled in a click event of one button. And update should be
in another click event of another button.
I hope I could explained my problem clearly. Any help would be highly
appreciated. Thanks for your time and comments in advance,
Reney
adapters and datasets, but I typed them all. The situation is like this:
There is a listbox with members pulled from the database.(I am using an
access db). The user selects one value from the listbox and clicks on one of
two buttons "ThisWeek" or "LastWeek". The button click events each has its
own SQL statement, pulling datarows from two different tables in the
database(they are related with "employeeID", which is selected in the
listbox I told before). Then the data adapter fills the dataset and it's
connected to one datagrid. The datagrid shows the values if the click event
completes successfully. But as I say, all the database connection, filling
and close processes are done in the click event.
The problem starts right after that. The user has the choice to modify the
dataset using the datagrid. And to update, he has to click on the "Update"
button in the form. But I don't kow how to make the update in antoher click
event. Since the datasets are created and tied to the grid in a different
click event. Now in another click event, the dataset is not recognized. So I
have to fill a new dataset, but this time, how is it going to recognize the
changes made to the dataset.
I am not very familiar with datagrids and datasets, so the topic is a little
bit out of my scope. After I looked through the Internet and forums, in all
the similar problems, they have a common thing that, they were filling the
dataset in the form_load events with simple sql statements. In my case, the
sql statement is dynamically changing with the value selected in a listbox
and the button pressed(Remember two buttons, "thisweek" and "lastweek"). And
the dataset is filled in a click event of one button. And update should be
in another click event of another button.
I hope I could explained my problem clearly. Any help would be highly
appreciated. Thanks for your time and comments in advance,
Reney