该名称在当前上下文中不存在。 [英] The name does not exist in the current context.

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

问题描述

我收到错误,因为当前上下文中不存在名称 mASS_VCCode



但在我的表中我是'我有该字段名称

I'm getting the error as the name mASS_VCCode does not exist in the current context.

But in My table i'm having that field name

<b>mASS_VCCode</b>



这是我的代码:



这是我的代码看起来的样子:



.
This is my code:

This is how my code looks:

var newAsset = new TB_MasterAsset
{
        mASS_VCCode = TXTAssetCode.Text,
        mASS_VCName = TXTAssetName.Text,
        mASS_VCDescription = TXTAssetDesc.Text,
        mASS_NUQuantity = mobjGenlib.GetDecimal(TXTQty.Text),
        mASS_NUCost = mobjGenlib.GetDecimal(TXTCost.Text),
        mASS_VCModel = TXTModel.Text,
        mASS_VCInvoiceno = TXTInvoiceno.Text,
        mASS_VCSerialno = mobjGenlib.GetDecimal(TXTSerialno.Text),
        mASS_VCBrandName = TXTBrandName.Text,
        mASS_VCAssignedto = TXTAssignedTo.Text,
        mASS_mACC_NUPKId_Manufacturer = mobjGenlib.ConvertLong(ManufactureID.Text),
        mASS_mATC_NUPKId_Category = mobjGenlib.ConvertLong(CategoryID.Text),
        mASS_mLOC_NUPKId_Location = mobjGenlib.ConvertLong(LocationID.Text),
        mASS_mDEP_NUPKId_Department = mobjGenlib.ConvertLong(DepartmentID.Text),
        mASS_NUIsActive = 1,
        mASS_mCMP_NUUniqueId = mobjGenlib.ConvertLong(TXTCompanyID.Text)
};
using (LQMasterAssetDataContext DB = new LQMasterAssetDataContext())
{
    //Existing Codes Will go
}

catch (Exception ee)
{
    string Error = ee.ToString();
        return false;
}







在VAR语句后直接跳转到Catch Block .... br />


可以帮助我解决这个问题。



先谢谢。




after VAR statement it directly jumps to Catch Block....

can any 1 pls help me to resolve this issue.

Thanks in Advance.

推荐答案

试试这个,希望你不需要另外的解释来了解问题所在。



Try this, hoping you don't need an additional explanation to understand what the problem was.

var mASS_VCCode = "some code";

using (LQMasterAssetDataContext DB = new LQMasterAssetDataContext())
{
// your existing code
}





这个问题很容易解决。



其实这个错误由于数据类型不匹配而导致fiel serialno ...



一旦我将其更改为nvarchar而不是数字,问题就解决了。



感谢所有帮助过我的人。
Hi
The problem was solved with ease.

Actually this error occurs due to mismatch in Datatype for the fiel serialno...

once i change it to nvarchar instead of numeric the problem solved.

Thanks for all the one who helped me.


这篇关于该名称在当前上下文中不存在。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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