Hello below is my code, i got this error Error "Overload resolution failed because no accessible 'New' can be called without a narrowing conversion:'Public SubNew(selectCommandText As String, selectConnection As System.Data.OleDb.OleDbConnection)': Argument matching parameter 'selectConnection' narrows from 'Object' to 'System.Data.OleDb.OleDbConnection'. 'Public Sub New(selectCommandText As String, selectConnectionString As String)': Argument matching parameter 'selectConnectionString' narrows from 'Object' to 'String')
What did i do is i declared "Public Shared cnn = New OleDb.OleDbConnection" in a class to make it global.
Then i called it in other class.
how can i solve this?
What did i do is i declared "Public Shared cnn = New OleDb.OleDbConnection" in a class to make it global.
Then i called it in other class.
VB.NET:
Try
'get data into list
If Not GlblVar.cnn.State = ConnectionState.Open Then
'open connection
GlblVar.cnn.Open()
End If
Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM student ", GlblVar.cnn)
'fill data to datatable
da.Fill(GlblVar.dt)
'close connection
GlblVar.cnn.Close()
Catch ex As Exception
MessageBox.Show("ERROR" & ex.Message)
End Try
how can i solve this?