I am working on a project, its purpose is to search a database and display the results in a data list so they can be used. I have the search working correctly but it only outputs to a data grid. Help please!
Protected Sub Button2_OnClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim objCommand As OleDbCommand
Dim objAdapter As OleDbDataAdapter
Dim objDataSet As DataSet
Dim strSearch As String
Dim objConnection As String = ("Provider=Microsoft.ACE.OLEDB.12.0;" _
& "Data Source=" & Server.MapPath("DB\ScrumManagementSystem.accdb") & ";")
Dim cn As New OleDbConnection(objConnection)
Dim strSQLQuery As String
strSearch = TextBox1.Text
If Len(Trim(strSearch)) > 0 Then
strSQLQuery = "SELECT FName & SName FROM tblUser WHERE FName LIKE '%" & Replace(strSearch, "'", "''") & "%' ORDER BY FName;"
cn.Open()
Dim cmd As New OleDbCommand(strSQLQuery, cn)
objCommand = New OleDbCommand(strSQLQuery, cn)
objAdapter = New OleDbDataAdapter(objCommand)
objDataSet = New DataSet()
objAdapter.Fill(objDataSet)
dgPaging1.DataSource = objDataSet
dgPaging1.DataBind()
cn.Close()
Else
TextBox1.Text = "Enter search criteria!"
End If
End Sub