本文介绍了在服务器上运行时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SqlConnection con = new SqlConnection("server=.; user id=sa;password=sa123;database=EMPLOYEE_DETAILS");
string S="Select * from EMPLOYEE_DETAILS WHERE DEPTNO="+Session["D"];
SqlDataAdapter da = new SqlDataAdapter(S,con);
DataSet ds = new DataSet();
da.Fill(ds, "EMPLOYEE_DETAILS");//showing error here
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
推荐答案
SqlConnection con = new SqlConnection("server=.; user id=sa;password=sa123;database=EMPLOYEE_DETAILS");
string S="Select * from EMPLOYEE_DETAILS WHERE DEPTNO="+Session["D"];
SqlDataAdapter da = new SqlDataAdapter(S,con);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
尝试使用Store程序来避免sql注入攻击!...
Try to use Store procedures to avoid sql injection attacks!...
这篇关于在服务器上运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!