Hi,
I have been trying for the past one week to connect and load a datagridview DatagridviewEmployeeID from a database HumanResourcesDB and EmployTbl to no avail, could someone please help me. Bellow is my code. Right now it looks like I binding but I think binding what I need. Please help me
Private Sub BtnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSearch.Click
Dim cmd As OleDbCommand = New OleDbCommand()
Dim connection As String = "Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Amaechi\Documents\Databases\Humanresouces.accdb"
'Dim conn As OleDbConnection
Dim ds As New DataSet
'Dim connection As New OleDbConnection(connectionString)
Dim dataAdapter As New OleDbDataAdapter(connectionString, connection)
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "getEmployID"
connection.Open()
dataAdapter.Fill(ds, "EmployeTbl")
cmd.ExecuteNonQuery()
connection.Close("")
DataGridViewCheckEmployee.DataMember = "EmployeeTbl"
I have been trying for the past one week to connect and load a datagridview DatagridviewEmployeeID from a database HumanResourcesDB and EmployTbl to no avail, could someone please help me. Bellow is my code. Right now it looks like I binding but I think binding what I need. Please help me
Quote:
Private Sub BtnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSearch.Click
Dim cmd As OleDbCommand = New OleDbCommand()
Dim connection As String = "Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Amaechi\Documents\Databases\Humanresouces.accdb"
'Dim conn As OleDbConnection
Dim ds As New DataSet
'Dim connection As New OleDbConnection(connectionString)
Dim dataAdapter As New OleDbDataAdapter(connectionString, connection)
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "getEmployID"
connection.Open()
dataAdapter.Fill(ds, "EmployeTbl")
cmd.ExecuteNonQuery()
connection.Close("")
DataGridViewCheckEmployee.DataMember = "EmployeeTbl"