本文介绍了变量名“@Param”已经声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户点击搜索按钮2倍以上,我歌厅给定code以下错误消息。可能有人请帮助我在做什么错了。

protected void btnSearch_Click(object sender, EventArgs e)
{
    DS.SelectCommand =
      "SELECT ReportName, ReportType,
       FROM Table
       WHERE ReportName LIKE @param
       ORDER BY ReportType Desc";
   DS.SelectParameters.Add("Param", searchTxtBox.Text.Replace("'", "''"));
   DS.DataBind();
   ListView1.DataBind();
}
解决方案

TRy

DS.SelectCommand =
    "SELECT ReportName, ReportType,
     FROM Table
     WHERE ReportName LIKE @param
     ORDER BY ReportType Desc";
DS.SelectParameters.Clear();
DS.SelectParameters.Add("Param", searchTxtBox.Text.Replace("'", "''"));

这篇关于变量名“@Param”已经声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 18:51
查看更多