Dim strKeyWord As String
Sub Page_Load(sender As Object, e As EventArgs)
strKeyWord = Me.txtKeyWord.Text
End Sub
Sub BindData()
Dim objConn As New OleDbConnection
Dim objCmd As New OleDbCommand
Dim dtAdapter As New OleDbDataAdapter
Dim ds As New DataSet
Dim strConnString,strSQL As String
strConnString = "Provider=Microsoft Sql Server Management Studio Source=" & Server.MapPath("database/mydatabase.mdb") & "; OLEDB:Database Password=;"
strSQL = "SELECT rpt_create_date,rpt_covernoteid,rpt_title,rpt_name,rpt_surname,rpt_settle_flag FROM rpt_master_report WHERE (rpt_create_date like '%" & strKeyWord & "%' and rpt_settle_flag is null) "
objConn.ConnectionString = strConnString
With objCmd
.Connection = objConn
.CommandText = strSQL
.CommandType = CommandType.Text
End With
dtAdapter.SelectCommand = objCmd
Sub myGridView_RowDataBound(sender As Object, e As GridViewRowEventArgs)
Dim lblrpt_create_date As Label = CType(e.Row.FindControl("lblrpt_create_date"), Label)
If Not IsNothing(lblrpt_create_date) Then
lblrpt_create_date.Text = e.Row.DataItem("rpt_create_date")
End If
Dim lblrpt_covernoteid As Label = CType(e.Row.FindControl("lblrpt_covernoteid"), Label)
If Not IsNothing(lblrpt_covernoteid) Then
lblrpt_covernoteid.Text = e.Row.DataItem("rpt_covernoteid")
End If
Dim lblrpt_title As Label = CType(e.Row.FindControl("lblrpt_title"), Label)
If Not IsNothing(lblrpt_title) Then
lblrpt_title.Text = e.Row.DataItem("rpt_title")
End If
Dim lblrpt_name As Label = CType(e.Row.FindControl("lblrpt_name"), Label)
If Not IsNothing(lblrpt_name) Then
lblrpt_name.Text = e.Row.DataItem("rpt_name")
End If
Dim lblrpt_surname As Label = CType(e.Row.FindControl("lblrpt_surname"), Label)
If Not IsNothing(lblrpt_surname) Then
lblrpt_surname.Text = e.Row.DataItem("rpt_surname")
End If
End Sub
Sub btnSearch_Click(sender As Object, e As EventArgs)
BindData()
End Sub