none
Strongly typed dataset used in application globally. RRS feed

  • Question

  • Heres the background:

    Using VS2010 and .Net 4.x

    Wrote app using XDS dataset to SQL DB.  After 40,000 rows in detail table I get out of memory when switching between reports. thus far forms are not affected.

    Have multiple forms each form has it's own dataset, tableadapters, bindings in the designer.

    Want to change to use a module to hold the data defines and then bind to form controls such as DropDown Lists, data grids, etc.

    The app imports a text file into a detail table and assigns that detail to a job header.  I really need to reduce memory usage. I still green with Datasets I mostly use ADO recordsets via VBA. 

    FIrst area of problem is a simple table called JobTypes, it fills two DropDown Combo boxes.  Using the data objects via the form things were just a click and select. Now I need to move to vars in the app. 

    The XSD file is called VALIDATOR with Tables JobTypes, ReportTypes, ScanDetail, and JobHaedr tables.

    My data module is as follows:

    Module modPSIDataValidator
    
    
      Public myDataSet As New ValidatorDataSet
     
      Public JobTypesTA As New ValidatorDataSetTableAdapters.JobTypesTableAdapter
      Public JobTypes As New ValidatorDataSet.JobTypesDataTable
      Public myDataSetBindSource As New BindingSource
      Public JobTypesBS As New BindingSource
    
      Public Sub Setup_DataSources()
    
        JobTypesTA.Fill(JobTypes)
        JobTypesBS.DataSource = JobTypes
    
      End Sub
    
    
    End Module
    

    In the form I have things as follows:

      Private Sub frmMain_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    
        Setup_DataSources()
    
        Me.cmboJobType.DataSource = JobTypesBS
        Me.cmboJobType.DisplayMember = "JobTypeDescript"
        Me.cmboJobType.ValueMember = "JobTypeID"
        Me.cmboJobType.Refresh()
    
      End Sub
    The table has 7 rows in it and yet the combo drop down list shows empty, there appears to be data as setting selectedindex to 0 does not cause an exception.

    Any suggestions?

    Larry

    Wednesday, March 21, 2012 6:21 PM

Answers

  • Hi Larry,

    I think you can try to use paging by SelectCommand in TableAdapter.

    >>Have multiple forms each form has it's own dataset, tableadapters, bindings in the designer.

    I think it is a good pratice, not sure about problems. Dataset is thread safety but TableAdapter doesn't.

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, March 22, 2012 7:31 AM
    Moderator
  • In debugging, if you set a breakpoint on "Me.cmboJobType.DataSource" and look at the DataTable JobTypes in the DataSet Viewer (or in the debugger watch window or however you want to look at it), you can see the 7 rows, all with data in the proper columns?

    And then, when you continue running the app, and click on the ComboBox to drop down the list, do you see an empty list containing space for 7 items (meaning those 7 items are blank)? Or does it just drop down an empty list with one blank item?


    ~~Bonnie Berent DeWitt [C# MVP]

    geek-goddess-bonnie.blogspot.com

    Sunday, March 25, 2012 1:35 AM

All replies

  • Hi Larry,

    I think you can try to use paging by SelectCommand in TableAdapter.

    >>Have multiple forms each form has it's own dataset, tableadapters, bindings in the designer.

    I think it is a good pratice, not sure about problems. Dataset is thread safety but TableAdapter doesn't.

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, March 22, 2012 7:31 AM
    Moderator
  • In debugging, if you set a breakpoint on "Me.cmboJobType.DataSource" and look at the DataTable JobTypes in the DataSet Viewer (or in the debugger watch window or however you want to look at it), you can see the 7 rows, all with data in the proper columns?

    And then, when you continue running the app, and click on the ComboBox to drop down the list, do you see an empty list containing space for 7 items (meaning those 7 items are blank)? Or does it just drop down an empty list with one blank item?


    ~~Bonnie Berent DeWitt [C# MVP]

    geek-goddess-bonnie.blogspot.com

    Sunday, March 25, 2012 1:35 AM