名称"sEcode"在当前上下文中不存在 [英] The name 'sEcode' does not exist in the current context

查看:84
本文介绍了名称"sEcode"在当前上下文中不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


访问数据时出现此错误:
名称" 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"在当前上下文中不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆