01.
int
maxRow = GridView1.Rows.Count;
02.
string
[] arrRow =
new
string
[maxRow];
03.
04.
05.
06.
07.
for
(
int
i = 0; i < maxRow ; i++) {
08.
arrRow[i] = GridView1.Rows[i].Cells[1].Text;
09.
10.
11.
SqlConnection conn =
new
SqlConnection(
"Data Source=VAN;Initial Catalog=PhotoRecord;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;"
);
12.
conn.Open();
13.
if
(chkAll.Checked ==
true
)
14.
{
15.
SqlCommand cmd =
new
SqlCommand(
"SELECT * FROM dbo.photo_info WHERE OrderNo LIKE '%"
+ arrRow[i] +
"%'"
, conn);
16.
SqlDataReader reader = cmd.ExecuteReader();
17.
if
(reader.Read())
18.
{
19.
20.
}
21.
else
22.
{
23.
24.
GridView1.DeleteRow(i);
25.
26.
}
27.
conn.Close();
28.
}