How to design dataTables or DataSets for forms on different panels
-
I have a pretty big program that I am developing. There are 2 different forms in the program. One of the forms has several panels on it and each panel has a form, or several forms. I had all of my queries coming from one dataSet but I had problems with conflicting dataTables. Then I created another dataSet for a couple of my list boxes and then it worked. Then I Tried to create 2 different dataSets for one of my panels. One of the dataSets included the database tables and fields that were needed to fill list and combo boxes with info and the other with the profile and schedule info. When I did this suddenly my form is glitchy. When I get the query from the original dataset it works fine, but when I get the query from the new dataset it does not work. What is the best way to design the datasets for a program to avoid these kinds of problems. Should I use multiple datasets? Would it be better for me to use a getData method instead of a fill method instead of using different datasets.
-
I have a pretty big program that I am developing. There are 2 different forms in the program. One of the forms has several panels on it and each panel has a form, or several forms. I had all of my queries coming from one dataSet but I had problems with conflicting dataTables. Then I created another dataSet for a couple of my list boxes and then it worked. Then I Tried to create 2 different dataSets for one of my panels. One of the dataSets included the database tables and fields that were needed to fill list and combo boxes with info and the other with the profile and schedule info. When I did this suddenly my form is glitchy. When I get the query from the original dataset it works fine, but when I get the query from the new dataset it does not work. What is the best way to design the datasets for a program to avoid these kinds of problems. Should I use multiple datasets? Would it be better for me to use a getData method instead of a fill method instead of using different datasets.
basically dataset is collection of datatable and it is always better to work with data table in such cases.. so please try to fetch data in minimum number of dataset (possibly one dataset). tehn bind the controls with various datatables...this will work in most cases...
Ashish Sehajpal
-
basically dataset is collection of datatable and it is always better to work with data table in such cases.. so please try to fetch data in minimum number of dataset (possibly one dataset). tehn bind the controls with various datatables...this will work in most cases...
Ashish Sehajpal
I generally do the opposite of what Ashish recommends. Get each table as data discreet entity (1 table per dataset) I use 2 types of data, static for lookup lists etc and transactional. The static tables I populate the first time they are used and remain in memory. These are in a class called MasterTables eg
'Local var to hold the table Private mvApp As DataTable 'Public property to expose the table Public Property App() As DataTable Get If mvApp Is Nothing Then mvApp = LoadApp() End If Return mvApp End Get Set(ByVal Value As DataTable) 'this allows the system to reload the table when the value is nothing mvApp = Value End Set End Property Private Function LoadApp() As DataTable ' Load the app table from the database Dim oClass As New clsApp Return oClass.GetRecord(cAllRecords) End Function
Note if you use a dataview to filter a table (when populating a list) then this can be reflected in the base table unless you copy the table.