关于asp.net代码的解释
private string valueGet = "";
private int intFormCount;
intFormCount = Request.Form.AllKeys.Length;
if (intFormCount == 0) {
Sda.SelectCommand = new SqlCommand();
Sda.SelectCommand.Connection = conn;
Sda.SelectCommand.CommandType = CommandType.Text;
Sda.SelectCommand.CommandText = "select * from phone where department='" + valueGet + "' ";
红色部分的意思及用意 请详细解释一下 谢谢
------解决方案--------------------获得url里面的deptid参数
------解决方案--------------------valueGet = Request.QueryString["deptid"];
==========================================
将URL传过来的deptid边量赋给valueGet;
所谓变量值是通过URL带参数传过来的,就是指:
如果这句代码的所在页面文件名为:wenjian.aspx,传参数就是以下形式:
Response.Redirect("wenjian.aspx?deptid=aaaa",true);
------解决方案--------------------
------解决方案--------------------说白了就一句话取URL传过来的值valueGet = Request.QueryString["deptid"];
用这个就可以
------解决方案--------------------intFormCount = Request.Form.AllKeys.Length;
查看Request.Forms的变量值了
valueGet = Request.QueryString["deptid"];
接受上一页传递过来的值。
------解决方案-------------------- private string valueGet = ""; //定文一个私有字符变量valueGet
private int intFormCount; //定文一个私有数值变量intFormCount
intFormCount = Request.Form.AllKeys.Length; //request.form里面有多少个数值参数
if (intFormCount == 0)