Help on BindingSource Control

Hi All,
Thanks for clicking.

Historical we have upgraded our VB6 program to VB.NET using the upgrade wizard.

If VB6 data bindings was classic ADO, the VB.NET converts this to it's own Interop classic ADO control.

Functionally this works fine! However, it won't be supported forever, and we are concerned with how much speed were sacrificing, especially over a network.

We have developed a small application using the BindingSource control, and we can navigate between records easily

My question is this.

Is this control an adequate data control to use on a VB.NET VS2005 application, thinking about it from a speed point fo view, and especially over a network, before we decide to convert over our 150+ forms in our main application??

Also as a cheeky added bonus, if anybody has any idea how much speed we are losing by using classic ADO in a VS2005 environment, it'd be great if you could share with me.

Thanks so much
LKearneyAsked:
Who is Participating?
 
SQL_SERVER_DBAConnect With a Mentor Commented:
In terms of the .NET framework, the way we access our data has also changed. Pretty much everything in .NET uses XML as its underlying data structure, and even records from database are represented internally as well formed XML, which is then converted to the data type required by the client application.

Since "classic" ASP's humble beginnings, ADO data access classes and methods have been re-written. When Microsoft decided to embark on its multi billion dollar .NET adventure, they also built a new version of ActiveX Data Objects (ADO) called ADO.NET.

there is a really good article for comparing ADO and ADO.NET
http://www.devarticles.com/c/a/ADO.NET/A-Practical-Comparison-of-ADO-and-ADO.NET/1/
0
 
VBRocksConnect With a Mentor Commented:
You know, I think the amount of time it takes to use a BindingSource is VERY insignificant.  Using a
BindingSource will not incure a big enough performance hit to be noticeable.  I've included some code
below for a performance test that demonstrates loading 10,000 records into a DataTable, and then
setting the DataSource for a DataGridView using a BindingSource, and not using a BindingSource.

Another thing to think about, is the amount of records that you are going to have in memory.  Honestly,
having over 1000 records in memory isn't very good, performance wise.  You'll find that searching,
filtering, enumerating, etc. will be slower with the more records you have in memory.  A better approach
is to do your filtering with your database when you retrieve your records, and have as few records
in your DataTable as possible.

'Performance test code:
    'Just have a DataGridView on your form named "DataGridView1"
    Public Sub DataLoadPerformanceTest()

        'Load the data into a DataTable
        Dim dt As DataTable = Create2ColumnTable()

        Dim sw As New Stopwatch()

        'Use the Stopwatch to time how long it takes using a BindingSource
        sw.Start()
        Dim bs As New BindingSource()
        bs.DataSource = dt
        Me.DataGridView1.DataSource = bs
        sw.Stop()
        MsgBox(sw.ElapsedMilliseconds)

        'Load the data into a DataTable
        Dim dt2 As DataTable = Create2ColumnTable()

        'Use the Stopwatch to time how long it takes using a DataTable
        sw.Reset()
        sw.Start()
        Me.DataGridView1.DataSource = dt2
        sw.Stop()
        MsgBox(sw.ElapsedMilliseconds)

    End Sub

    'Creates a DataTable with 10,000 records in it.
    Public Function Create2ColumnTable() As DataTable

        'Create a new datatable and set table name
        Dim dt As New DataTable("MyItems")

        'Add 2 columns to the table,
        '    setting the datatype of the id column to Int16
        dt.Columns.Add("ID")
        'dt.Columns("ID").DataType = GetType(System.Int16)
        dt.Columns.Add("Item")

        'Loop and add rows to table
        For i As Int16 = 1 To 10000
            dt.Rows.Add(i, "This is a test item with the number:  " & i.ToString)
        Next

        'Return the table
        Return dt

    End Function


0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.