How to print payment,penalty_date,amount columns in the seach output in addition to
playerno column? The code blow only outputs the playerno. I be happy if some one show me where should i mention the name of other columns.Thanks
<%@ Page Language="
VB" Debug="True" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script language="
VB" runat="server">
Sub btnSearch_OnClick(sender as Object, e as EventArgs)
Dim objConnection As SqlConnection
Dim objCommand As SqlCommand
Dim objAdapter As SqlDataAdapter
Dim objDataSet As DataSet
Dim strSearch As String
Dim strSQLQuery As String
' Get Search
strSearch = txtSearch.Text
' If there's nothing to search for then don't search
' o/w build our SQL Query and execute it.
If Len(Trim(strSearch)) > 0 Then
' Set up our connection.
objConnection = New SqlConnection("Data Source=(local);" _
& "Initial Catalog=teniss2;User Id=web;Password=web;" _
& "Connect Timeout=15;Network Library=dbmssocn;")
' Set up our SQL query text.
strSQLQuery = "SELECT playerno" _
& "FROM players " _
& "WHERE playerno LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
& "ORDER BY playerno;"
' Create new command object passing it our SQL query
' and telling it which connection to use.
objCommand = New SqlCommand(strSQLQuery, objConnection)
' Get a DataSet to bind the DataGrid to
objAdapter = New SqlDataAdapter(objCommand)
objDataSet = New DataSet()
objAdapter.Fill(objDataSet)
' DataBind DG to DS
dgPaging.DataSource = objDataSet
dgPaging.DataBind()
objConnection.Close()
Else
txtSearch.Text = "Enter Search Here"
End If
End Sub
</script>
<html>
<head>
<title>ASP.NET Database Search</title>
</head>
<body>
<form runat="server">
<p>Search our sample db by first or last name. (% returns all)</p>
<asp:TextBox id="txtSearch" runat="server" />
<asp:Button id="btnSearch" runat="server"
Text = "Search"
OnClick = "btnSearch_OnClick"
/>
<p>[Try 'am' or 'er' for an example]</p>
<asp:DataGrid id="dgPaging" runat="server"
HeaderStyle-Font-Bold="True"
/>
</form>
<p>
Click <a href=".asp">here</a>
to read about and download the source code.
</p>
</body>