怎么返回数据集合的条数的啊!里面有程序,请各位看看啊!!!!!!
try
{
string strsql= "SELECT * FROM yh WHERE yh='";
strsql += this.textBox1.Text + "' AND mm='";
strsql += this.textBox2.Text + "'";
this.sqlCommand1.CommandText = strsql;
this.sqlCommand1.Connection = this.sqlConnection1;
this.sqlConnection1.Open();
this.sqlCommand1.ExecuteNonQuery();
this.sqlConnection1.Close();
this.sqlDataAdapter1.Fill(this.dataSet1, "yh");
int a= this.dataSet1.Tables["yh"].Rows.Count;
MessageBox.Show(a.ToString());
}
catch(Exception Err)
{
MessageBox.Show("更新数据库记录操作失败:"+Err.Message,"信息提示",
MessageBoxButtons.OK,MessageBoxIcon.Information);
//如果打开了连接,则关闭它
if(this.sqlConnection1.State==ConnectionState.Open)
{
this.sqlConnection1.Close();
}
}
我定义的a返回不出我查询得到记录的行数,请大家帮我看看啊