0

I have 1 tabcontrol with 2 tabpages, each tabpage with 1 datagridview (different tables for each), I load these 2 databases on the form load:

Me.AnndepTableAdapter.Fill(Me.HonorDataSet2.anndep)
 Me.SysdepTableAdapter.Fill(Me.HonorDataSet.sysdep)


  Dim sql1 As String
 Dim con1 As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\user\Desktop\honor.mdb")
        con1.Open()
        sql1 = "SELECT * FROM sysdep"

        Dim adapter1 As New OleDbDataAdapter(sql1, con1)

        Dim dt1 As New DataTable("sysdep")
        adapter1.Fill(dt1)

        DataGridView1.DataSource = dt1
        con1.Close()
       


        
        Dim sql2 As String
        Dim con2 As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\user\Desktop\honor.mdb")
        con2.Open()
        sql2 = "SELECT * FROM anndep"

        Dim adapter As New OleDbDataAdapter(sql2, con2)

        Dim dt2 As New DataTable("anndep")
        adapter.Fill(dt2)

        DataGridView2.DataSource = dt2
        con2.Close()

THE TABPAGE1 IS ALWAYS WORKING, SAME CODE ON THE TABPAGE2 IS NOT REALLY WORKING.

HOW DO YOU LOAD DIFFERENT DATABASES ON THE TABCONTROL? Thanks.

1
Contributor
1
Reply
5
Views
6 Years
Discussion Span
Last Post by needanswer
0

I have 1 tabcontrol with 2 tabpages, each tabpage with 1 datagridview (different tables for each), I load these 2 databases on the form load:

Me.AnndepTableAdapter.Fill(Me.HonorDataSet2.anndep)
 Me.SysdepTableAdapter.Fill(Me.HonorDataSet.sysdep)


  Dim sql1 As String
 Dim con1 As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\user\Desktop\honor.mdb")
        con1.Open()
        sql1 = "SELECT * FROM sysdep"

        Dim adapter1 As New OleDbDataAdapter(sql1, con1)

        Dim dt1 As New DataTable("sysdep")
        adapter1.Fill(dt1)

        DataGridView1.DataSource = dt1
        con1.Close()
       


        
        Dim sql2 As String
        Dim con2 As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\user\Desktop\honor.mdb")
        con2.Open()
        sql2 = "SELECT * FROM anndep"

        Dim adapter As New OleDbDataAdapter(sql2, con2)

        Dim dt2 As New DataTable("anndep")
        adapter.Fill(dt2)

        DataGridView2.DataSource = dt2
        con2.Close()

THE TABPAGE1 IS ALWAYS WORKING, SAME CODE ON THE TABPAGE2 IS NOT REALLY WORKING.

HOW DO YOU LOAD DIFFERENT DATABASES ON THE TABCONTROL? Thanks.

Actually, I found the problem, the way I load the databases were ok, I got the textbox.readonly = true to block the editing.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.