01.
Private
Sub
Button1_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
Button1.Click
02.
Dim
strSQL
As
String
03.
Dim
mycommand
As
SqlCommand
04.
Dim
dr
As
SqlDataReader
05.
Dim
dt
As
DataTable
06.
07.
If
CheckBox1.CheckState = CheckState.Checked
Then
08.
strSQL =
"SELECT ..."
09.
End
If
10.
11.
If
CheckBox2.CheckState = CheckState.Checked
Then
12.
strSQL =
"SELECT ..."
13.
End
If
14.
15.
mycommand =
New
SqlCommand(strSQL)
16.
dr = mycommand.ExecuteReader
17.
If
dr.HasRows
Then
18.
dt =
New
DataTable
19.
dt.Load(dr)
20.
21.
DataGridView1.DataSource = dt
22.
Else
23.
DataGridView1.DataSource =
Nothing
24.
End
If
25.
End
Sub