01.
Dim
i
As
Integer
02.
Dim
detail
As
String
03.
strSQL =
"SELECT * FROM detail where name='"
& TextBox1.Text &
"' and status='1'"
04.
da =
New
SqlDataAdapter(strSQL, Conn)
05.
da.Fill(ds,
"detail"
)
06.
If
ds.Tables(
"detail"
).Rows.Count <> 0
Then
07.
For
i = 0
To
ds.Tables(
"detail"
).Rows.Count - 1
08.
detail = ds.Tables(
"detail"
).Rows(0).Item(
"id"
).ToString()
09.
strSQL =
"UPDATE detail SET status='2' where id='"
& detail &
"'"
10.
Dim
comSave
As
New
SqlCommand
11.
With
comSave
12.
.CommandType = CommandType.Text
13.
.CommandText = strSQL
14.
.Connection = Conn
15.
.ExecuteNonQuery()
16.
End
With
17.
Next
18.
MessageBox.Show(
"เสร็จสิ้น"
)
19.
ShowDataadd()
20.
Else
21.
MessageBox.Show(
"ไม่มีข้อมูล"
)
22.
DataGridView1.Visible =
False
23.
End
If