请教如何在以下查询代码中加入一个统计的功能
参照例题做了一个查询功能,现在想做一个统计功能,就是点击“查询”按钮后,能统计当前水晶报表共有多少行,用“select count(*) from tabel”语句,关键这个条件我不会用sqlparameter来调用,有高手能指导下吗?
btn的CS代码如下:
protected void btnSelect_Click(object sender, EventArgs e)
{
string exSql = "";
SqlParameter[] parameters = new SqlParameter[5];
if (txtISDN.Text.Trim().Length > 0)
{
exSql += " and isdn=@ISDN";
SqlParameter isdn = new SqlParameter("@ISDN", SqlDbType.VarChar);
isdn.Value = txtISDN.Text.Trim();
parameters[0] = isdn;
}
if (txtName.Text.Trim().Length > 0)
{
exSql += " and bookname like @NAME ";
SqlParameter name = new SqlParameter("@NAME", SqlDbType.VarChar);
name.Value = "%" + txtName.Text.Trim() + "%";
parameters[1] = name;
}
if (txtPublisher.Text.Trim().Length > 0)
{
exSql += " and publisher like @PUBLISHER ";
SqlParameter publisher = new SqlParameter("@PUBLISHER", SqlDbType.VarChar);
try
{
if (txtPublisher.Text == "全部")
{
publisher.Value = "%" + "" + "%";