I am trying to make an asp.net webpage that does exactly the same thing as my application. This application searches a database for all names beginnig with the letter T and populated a gridview. on trying to use the same code in asp it wont work. could i please have some help in converting it such that i can use it in asp.net for my website
Imports System.Data
Imports System.Data.OleDb
Public Class Form1
' some code here
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the ' RunnersdbDataSet.Runners' table. You can move, or remove it, as needed.
Me.RunnersTableAdapter.Fill(Me.RunnersdbDataSet.Ru nners)
' create a connection string
Dim connString As String = "Provider= Microsoft.Jet.OLEDB.4.0;Data Source=C:\runnersdb.mdb"
Dim myConnection As OleDbConnection = New OleDbConnection
myConnection.ConnectionString = connString
' create a data adapter
Dim da As OleDbDataAdapter = New OleDbDataAdapter("Select Name from Runners WHERE Name LIKE 'T%'", myConnection)
' create a new dataset
Dim ds As DataSet = New DataSet
' fill dataset
da.Fill(ds, "Runners")
' write dataset contents to an xml file by calling WriteXml method
' Attach DataSet to DataGrid
DataGridView1.DataSource = ds.Tables(0).DefaultView
End Sub
End Class
Imports System.Data
Imports System.Data.OleDb
Public Class Form1
' some code here
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the ' RunnersdbDataSet.Runners' table. You can move, or remove it, as needed.
Me.RunnersTableAdapter.Fill(Me.RunnersdbDataSet.Ru nners)
' create a connection string
Dim connString As String = "Provider= Microsoft.Jet.OLEDB.4.0;Data Source=C:\runnersdb.mdb"
Dim myConnection As OleDbConnection = New OleDbConnection
myConnection.ConnectionString = connString
' create a data adapter
Dim da As OleDbDataAdapter = New OleDbDataAdapter("Select Name from Runners WHERE Name LIKE 'T%'", myConnection)
' create a new dataset
Dim ds As DataSet = New DataSet
' fill dataset
da.Fill(ds, "Runners")
' write dataset contents to an xml file by calling WriteXml method
' Attach DataSet to DataGrid
DataGridView1.DataSource = ds.Tables(0).DefaultView
End Sub
End Class