Public Sub GetData()
If Not con.State = ConnectionState.Open Then
con.Open()
End If
Dim da As New SqlDataAdapter("SELECT * FROM EMPLOYEE", con)
Dim dt As New DataTable
da.Fill(dt)
Me.dgvKY.DataSource = dt
con.Close()
End Sub
I found this error caught:
Error 1 Overload resolution failed because no accessible 'New' can be called without a narrowing conversion:
'Public Sub New(selectCommandText As String, selectConnection As System.Data.SqlClient.SqlConnection)': Argument matching parameter 'selectConnection' narrows from 'Object' to 'System.Data.SqlClient.SqlConnection'.
'Public Sub New(selectCommandText As String, selectConnectionString As String)': Argument matching parameter 'selectConnectionString' narrows from 'Object' to 'String'.