Help on BindingSource Control

Posted on 2007-10-10
Medium Priority
Last Modified: 2013-11-26
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
Question by:LKearney
LVL 16

Accepted Solution

SQL_SERVER_DBA earned 250 total points
ID: 20048724
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
LVL 27

Assisted Solution

VBRocks earned 250 total points
ID: 20048896
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
        Dim bs As New BindingSource()
        bs.DataSource = dt
        Me.DataGridView1.DataSource = bs

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

        'Use the Stopwatch to time how long it takes using a DataTable
        Me.DataGridView1.DataSource = dt2

    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("ID").DataType = GetType(System.Int16)

        '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)

        'Return the table
        Return dt

    End Function


Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Integration Management Part 2
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question