我想在我的程序运行 while
一次命令后暂停我的程序,并等待button4_click
继续进行一次迭代。每次单击 button4 都应运行while
一次循环。
代码:
private void button2_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(connectString);
conn.Open();
if (this.textBox3.Text != "")
{
this.listView1.Items.Clear();
SqlCommand cmd = new SqlCommand("select * from customer", conn);
SqlDataReader read = cmd.ExecuteReader();
while (read.Read())
{
this.listView1.Items.Add(read.GetValue(0).ToString());
this.listView1.Items.Add(read.GetValue(1).ToString());
this.listView1.Items.Add(read.GetValue(2).ToString());
}
read.Close();
conn.Close();
}
}