第一次查询正常,第二次查询就会多查询数据一次,第三次再点击按钮查询的时候又会查询三次,奇怪了!那为给麻烦看看原因!!
private void btnQuery_Click(object sender, EventArgs e)
{
dataG_rsj.Rows.Clear();
Bw.WorkerSupportsCancellation = true;
Bw.WorkerReportsProgress = true;
Bw.DoWork += new DoWorkEventHandler(Add);//绑定事件
Bw.ProgressChanged += new ProgressChangedEventHandler(Progress);
Bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(End);
Bw.RunWorkerAsync();
}
BackgroundWorker Bw = new BackgroundWorker();
public void Add(object sender, DoWorkEventArgs e)
{
string strSql = "select * from Sale_Table";
OracleDataReader reader = App.DBE.ExecReader(strSql);
object[] objcell = new object[34];
if (reader.HasRows)
{
while (reader.Read())
{
if ((Bw.CancellationPending == true))
{
e.Cancel = true;