01.
string
strConn =
"data source=.;initial catalog=ITE499;Max Pool Size=500;integrated security=SSPI"
;
02.
03.
SqlConnection Conn =
new
SqlConnection(strConn);
04.
05.
if
(Conn.State == ConnectionState.Closed)
06.
{
07.
Conn.Open();
08.
}
09.
SqlCommand Cmd = Conn.CreateCommand();
10.
Cmd.CommandType = CommandType.Text;
11.
12.
13.
dataGridView1.Visible =
false
;
14.
textBox1.Visible =
true
;
15.
for
(
int
allwordid = 1 ; allwordid < 671 ; allwordid++)
16.
{
17.
18.
MessageBox.Show(Convert.ToString(allwordid));
19.
20.
string
strsql =
"select stop_word from stopword where stop_id="
+ allwordid;
21.
Cmd.CommandText = strsql;
22.
SqlDataReader r = Cmd.ExecuteReader();
23.
24.
while
(r.Read() ==
true
)
25.
{
26.
string
stop = r[
"stop_word"
].ToString();
27.
28.
29.
int
result = 0;
30.
31.
string
deletestrsql =
"DELETE FROM term1 WHERE term_word='"
+ stop +
"'"
;
32.
33.
34.
Cmd.CommandText = deletestrsql;
35.
36.
result = Cmd.ExecuteNonQuery();
37.
38.
if
(result != -1)
39.
{
40.
41.
}
42.
43.
Conn.Close();
44.
45.
}
46.
47.
}
48.
49.
50.
if
(allwordid == 670)
51.
{
52.
MessageBox.Show(
"ลบแล้ว"
);
53.
}
54.
}