0% found this document useful (0 votes)
19 views2 pages

Search

Uploaded by

Nurul Nabilah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

Search

Uploaded by

Nurul Nabilah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

TextBox1.Text = "" Xor RadioButton4.

Checked = True Then


MsgBox("Please insert a keyword", vbExclamation, "Required")
TextBox1.Select()

Else

Try

If RadioButton1.Checked = True Then

Dim strsql = "SELECT clientname,address, bank, price,


description from tblLegal where address like '%" & TextBox1.Text & "%'"

Dim cmdDataGrid As MySqlCommand = New MySqlCommand(strsql,


DBconnection)
Dim da As New MySqlDataAdapter
da.SelectCommand = cmdDataGrid
Dim dt As New DataTable
da.Fill(dt)
DataGridView1.DataSource = dt

ElseIf RadioButton2.Checked Then

Dim strsql = "SELECT clientname,address, bank, price,


description from tblLegal where clientname like '%" & TextBox1.Text & "%'"

Dim cmdDataGrid As MySqlCommand = New MySqlCommand(strsql,


DBconnection)
Dim da As New MySqlDataAdapter
da.SelectCommand = cmdDataGrid
Dim dt As New DataTable
da.Fill(dt)
DataGridView1.DataSource = dt

ElseIf RadioButton3.Checked Then

Dim strsql = "SELECT clientname,address, bank, price,


description from tblLegal where description like '%" & TextBox1.Text & "%'"

Dim cmdDataGrid As MySqlCommand = New MySqlCommand(strsql,


DBconnection)
Dim da As New MySqlDataAdapter
da.SelectCommand = cmdDataGrid
Dim dt As New DataTable
da.Fill(dt)
DataGridView1.DataSource = dt

ElseIf RadioButton4.Checked Then

If ComboBox2.Text = "Yes" Then


Dim strsql = "SELECT clientname,address, bank, price,
description from tblLegal where softcopy<>'" & "" & "'"
Dim cmdDataGrid As MySqlCommand = New MySqlCommand(strsql,
DBconnection)
Dim da As New MySqlDataAdapter
da.SelectCommand = cmdDataGrid
Dim dt As New DataTable
da.Fill(dt)
DataGridView1.DataSource = dt

ElseIf ComboBox2.Text = "No" Then


Dim strsql = "SELECT clientname,address, bank, price,
description from tblLegal where softcopy='" & "" & "'"

Dim cmdDataGrid As MySqlCommand = New MySqlCommand(strsql,


DBconnection)
Dim da As New MySqlDataAdapter
da.SelectCommand = cmdDataGrid
Dim dt As New DataTable
da.Fill(dt)
DataGridView1.DataSource = dt

End If

End If

DBconnection.Close()

Catch ex As Exception
MsgBox(ex.ToString())
End Try

End If

You might also like