datasets is this right?

ramrodcar used Ask the Experts™
made a strongly typed dataset with a single parameterized datatable (tied to a sp), here's my code. Because i'm calling this getData method of the dataset 4 times, i just want to make sure i'm doing this in the correct way (putting it into a regular dataset, as i need to keep track of the output of each of the four iterations).
should i be instantiating the typed dataset and using that to add the tables to, or use the regular dataset and fill it with the four tableadapters from the instantiated typed dataset?

 Dim ds As DataSet = New DataSet
                Dim dsMachSales As New ds04_CatSales
                Dim taCatSales As spMMC04d_FinalTableAdapter = New spMMC04d_FinalTableAdapter

                Dim dtHLSales As ds04_CatSales.spMMC04d_FinalDataTable = _
                 taCatSales.GetData("HL", _intStartMonth, _intEndMonth, _txtGroupName)
                dtHLSales.TableName = "tblHL"

                Dim dtVLSales As ds04_CatSales.spMMC04d_FinalDataTable = _
                    taCatSales.GetData("VL", _intStartMonth, _intEndMonth, _txtGroupName)
                dtVLSales.TableName = "tblVL"

                Dim dtHCSales As ds04_CatSales.spMMC04d_FinalDataTable = _
                                    taCatSales.GetData("HC", _intStartMonth, _intEndMonth, _txtGroupName)
                dtHCSales.TableName = "tblHC"

                Dim dtVCSales As ds04_CatSales.spMMC04d_FinalDataTable = _
                    taCatSales.GetData("VC", _intStartMonth, _intEndMonth, _txtGroupName)
                dtVCSales.TableName = "tblVC"
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2007
based on what you posted and what I think you're doing (if I understand correctly), I think what you have is fine....

but looking at the GetData function and the params you have set makes me wonder if instead of doing 4 "iterations" of GetData, if GetData didn't have that first parameter, you could return one datatable and filter *after* the full dataset comes back...but I'm making the assumption that "HL","VL","HC" and "VC" are salestypes or something that is returned in a column of the datatable which you could then filter off of.
this would mean one db call (one GetData call) instead of 4....

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial