Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

change datagridview dataset

$
0
0

I have several different companies that each have their own database and have identical tables and schemas.

I have set a datagridview bound to one of the tables.    Using the Binding Navigator, this enables me to easily update, delete and add to the datatable in the database.   

I would like to be able to change the database through code.   In this example, the JJOBDataSet is populated from an Access Database.   It would be populated from another Database.

Being able to do this would also be very valuable in building and printing reports.

I know that this can be done by dynamically building the DataGridView and then coding each change; however, the automatic properties of designing and updating are very attractive.

Public Class Employees
    Private Sub Employees_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.EmployeesTableAdapter.Fill(Me.JJOBDataSet.Employees)
    End Sub

    Private Sub dgvEmployee_RowLeave(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvEmployee.RowLeave
        Me.Validate()
        Me.EmpTableAdapterManager.UpdateAll(Me.JJOBDataSet)
    End Sub

End Class


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>