Sub BindData()
Dim tableName = testType.Text
Dim hospitalName = hospital.Text
Dim hnName = txtHn.Text
Dim startDate = txtStartDate.Text
Dim endDate = txtEndDate.Text
If hospitalName <> Nothing Then
End If
Dim dtAdapter As New OleDbDataAdapter
Dim ConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Database.mdb"
Dim sb As New StringBuilder()
sb.Remove(0, sb.Length)
sb.Append("SELECT * ")
sb.Append("FROM " + testType.Text + " ")
sb.Append("WHERE Status = 'Y' ")
If hospital.Text <> Nothing Then
sb.Append("and HospitalName like '" + hospital.Text + "' ")
End If
If txtHn.Text <> Nothing Then
sb.Append("and HN like '%" + txtHn.Text.Trim + "%' ")
End If
If txtStartDate.Text <> Nothing Then
sb.Append("and Date >= " + txtStartDate.Text + " ")
End If
If txtEndDate.Text <> Nothing Then
sb.Append("and Date <= " + txtEndDate.Text + " ")
End If
Dim SQLString As String = sb.ToString
Dim OleDBConn1 As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(ConnString)
Dim DataSet1 As New DataSet()
Dim OleDbDataAdapter1 As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(SQLString, OleDBConn1)
OleDBConn1.Open()
OleDbDataAdapter1.Fill(DataSet1, tableName)
GridViewList.DataSource = DataSet1.Tables(tableName)
'SELECT * FROM HBVL WHERE Status = 'Y' and HN like '1*'
OleDBConn1.Close()
OleDBConn1 = Nothing