I create small database and I want to show all information about the students when a techer enter
Students ID I caret my database using visual studio 2008
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim constr as new OleDb.OleDbConnection
constr.ConnectionString = "Provider=localhost;data source=C:\USERS\USER\DOCUMENTS\VISUAL STUDIO 2008\PROJECTS\APP V1.2\APP V1.2\DATABASE1.MDF"
Dim sqlstr as string=""
sqlstr="select * from Table1 where StudentID=" & Textbox1.text
Try
Dim ds As New DataSet
Dim apt As New SqlDataAdapter
apt.Dispose()
ds.Dispose()
apt = New SqlDataAdapter(sqlstr, constr)
apt.Fill(ds)
Datagridview1.DataSource = ds.Tables(0)
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
End Sub
I keep get this error message
Error 1 Overload resolution failed because no accessible 'New' can be called with these arguments:
'Public Sub New(selectCommandText As String, selectConnection As System.Data.SqlClient.SqlConnection)': Value of type 'System.Data.OleDb.OleDbConnection' cannot be converted to 'System.Data.SqlClient.SqlConnection'.
'Public Sub New(selectCommandText As String, selectConnectionString As String)': Value of type 'System.Data.OleDb.OleDbConnection' cannot be converted to 'String'. C:\Users\user\Documents\Visual Studio 2008\Projects\app v1.2\app v1.2\Form1.vb 30 19 app v1.2