编程知识 cdmana.com

The error in the second half of the program is that the column name a is invalid, but my idea is that a is a parameter

namespace Volunteer communication
{
public partial class History : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

    }    protected void  Inquire about _Click(object sender, EventArgs e)    {        String ConnStr = "Data Source=DESKTOP-3IT6TKJ;Initial Catalog= League tables ;Integrated Security=True";        SqlConnection conn = new SqlConnection(ConnStr);        SqlCommand cmd = new SqlCommand();        cmd.Connection = conn;        cmd.CommandText = "SELECT * from   Historical table by section  WHERE  fraction  = '" + fenshu.Text.Trim() + "'";        conn.Open();        SqlDataReader dr = cmd.ExecuteReader();        //this.Update(dr);        this.GridView3.DataSource = dr;        this.DataBind();        //this.GridView3.DataSourceID = null;    }    protected void GridView3_SelectedIndexChanged(object sender, EventArgs e)    {           }    protected void  Enter the score _TextChanged(object sender, EventArgs e)    {    }    protected void fenshu_TextChanged(object sender, EventArgs e)    {    }    protected void xuexiao_Click(object sender, EventArgs e)    {        String ConnStr = "Data Source=DESKTOP-3IT6TKJ;Initial Catalog= League tables ;Integrated Security=True";        SqlConnection conn = new SqlConnection(ConnStr);        SqlCommand cmd = new SqlCommand();        cmd.Connection = conn;        int a;        a=int.Parse(qujian.Text .Trim());        // cmd.CommandText = "SELECT * from   History table  WHERE  fraction  > '" + fenshu.Text.Trim() + "'+"qujian.Text.Trim()"and fraction  < '" + fenshu.Text.Trim() + "'+"qujian.Text.Trim()" ";        cmd.CommandText = "select * from  Physical watch  where  Minimum score for filing >'" + fenshu.Text.Trim() + "' -a  and  Minimum score for filing <'" + fenshu.Text.Trim() + "'+a";                //cmd.CommandText = "select * from  Physical watch  where  Minimum score for filing >'" + fenshu.Text.Trim() + "'- 5 and  Minimum score for filing <'" + fenshu.Text.Trim() + "'+ 5";        conn.Open();        SqlDataReader dr = cmd.ExecuteReader();        this.GridView4.DataSource = dr;        this.DataBind();

img

版权声明
本文为[CSDN Q & A]所创,转载请带上原文链接,感谢
https://cdmana.com/2021/12/20211207183529703Y.html

Scroll to Top