嗨 访问数据时出现此错误: 名称" sEcode"在当前上下文中不存在" 导致此问题的代码段如下
Hi I am getting this error while accessing data: "The name ''sEcode'' does not exist in the current context" The code snippet which causes this is below
protected void btnEmpDet_Click(object sender, EventArgs e) { Response.Redirect("empfetch.aspx?Ecode=" + sEcode + "&Employeename=" + sEmployeename + "&department" + sdepartment + "&location" + slocation); }我该怎么办才能消除错误? 谢谢
What can I do to remove the error? Thanks
推荐答案avijit1112010写道: avijit1112010 wrote:
"empfetch.aspx?Ecode =" + sEcode +&
"empfetch.aspx?Ecode=" + sEcode + "&
您正在尝试使用名为"sEcode"的变量.我在您的按钮单击事件方法中找不到该定义.那是全局变量吗? 错误提示它不是定义的变量(不是全局变量!). 为了解决这个问题,在使用Response.Redirect之前,声明并定义您要使用的所有查询字符串的值.
You are trying to use a variable named ''sEcode''. I don''t find that defined in your button click event method. Is that a Global variable? Error suggests it''s not a defined variable (not global!). In order to resolve, before using the Response.Redirect, declare and define the values of all the query strings you are trying to use.
是否已声明sEcode ? 如果尚未声明,IDE将无法识别它. 要么将其声明为Public,要么将其声明为private. 这样,它就可以被看到"并变得可用. Have you declared sEcode? If it has not been declared the IDE cannot recognise it. Either declare it as Public or within the sub as private. That way it will be ''seen'' and made usable.
您在哪里定义了sEcode? 请重新检查变量名称. Where did you defined sEcode ? please recheck the variable name.
更多推荐
名称"sEcode"在当前上下文中不存在
发布评论