Я не могу найти, где имя = "Мэри" в asp.net - PullRequest
0 голосов
/ 02 июля 2019

Я написал запрос о том, где name = (как показано ниже) в asp.net, но он не может работать.

protected void BindData()
{
    DataSet ds;
    string SQL = "";
    SQL =@"select  * from table where name='"+mary+"'";
    // or SQL=@"select  * from table where name='mary'";
    ds = CreateDataSource(string.Format("exec P_PageData '{0}',{1},{2}", SQL, this.SplitPage1.CurrentPage, this.SplitPage1.PageSize));
    if (ds != null && ds.Tables.Count == 3)
    {

        this.SplitPage1.CurrentPage = Convert.ToInt32(ds.Tables[1].Rows[0]["CurPage"]);
        this.SplitPage1.TotalRecorder = Convert.ToInt32(ds.Tables[1].Rows[0]["Total"]);
        this.rptPremissionList.DataSource = ds.Tables[2];
        this.rptPremissionList.DataBind();
    }

}

Два способа запроса 'mary' и '"+ mary +"' неверны.Пожалуйста, помогите мне найти, где проблема.Или я должен использовать параметры?

...