必须声明标量变量@nCODE? [英] must declare the scalar variable @nCODE ?

查看:128
本文介绍了必须声明标量变量@nCODE?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的

我正在尝试通过以下代码插入数据库表:

I'm trying to insert in the database table by sing the following code :

 If MsgBox("Do you want to save '" & Me.TxtItemID.Text & "' & '" & Me.TxtRetail.Text & "'", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "(NS) - Save?") = MsgBoxResult.Yes Then
           
 Me.asInsert.SaveValueIN("INSERT INTO LUP_ITEMSZM (nCODE, sITEM_DESC, nUNIT_COST, nSTOCK, nUNIT_PRICE, sPIECE_DESC, sPIECE_PACK, sSTATUS , sSupplier_NAME) VALUES(@nCODE, @sITEM_DESC,  , @nUNIT_COST,@nSTOCK, @nUNIT_PRICE,  @sPIECE_DESC,@sPIECE_PACK, @sSTATUS,  @sSupplier_NAME)")





                SqlInsertCommand1.Parameters.Add(New SqlParameter("@nCODE", SqlDbType.BigInt)).Value = Me.TxtItemID.Text.Trim
                SqlInsertCommand1.Parameters.Add(New SqlParameter("@sITEM_DESC", SqlDbType.NVarChar)).Value = Me.txtItemDesc.Text.Trim
                SqlInsertCommand1.Parameters.Add(New SqlParameter("@nUNIT_COST", SqlDbType.Money)).Value = Me.TxtCost.Text.Trim
                SqlInsertCommand1.Parameters.Add(New SqlParameter("@nSTOCK", SqlDbType.BigInt)).Value = Me.TxtQtyStock.Text.Trim
                SqlInsertCommand1.Parameters.Add(New SqlParameter("@nUNIT_PRICE", SqlDbType.Money)).Value = Me.TxtRetail.Text.Trim
                SqlInsertCommand1.Parameters.Add(New SqlParameter("@sPIECE_DESC", SqlDbType.NVarChar)).Value = Me.TxtPcsDesc.Text.Trim
                SqlInsertCommand1.Parameters.Add(New SqlParameter("@sPIECE_PACK", SqlDbType.NVarChar)).Value = Me.TxtPPP.Text.Trim
                SqlInsertCommand1.Parameters.Add(New SqlParameter("@sSTATUS", SqlDbType.NVarChar)).Value = Me.DmnStatus.SelectedIndex
                SqlInsertCommand1.Parameters.Add(New SqlParameter("@sSupplier_NAME", SqlDbType.NVarChar)).Value = Me.CmbSupplier.SelectedItem.col1

  Me.TxtItemID.Focus()
            End If

我输入了nCODE格式的文本:10386001

I entered in the nCODE filed text : 10386001

不知道为什么会出错:必须声明标量变量@nCODE

don't know why am getting an error: must declare the scalar variable @nCODE

尽管数据库表中的nCode类型Bigint

Although the nCode type in database table  Bigint

需要您的帮助

推荐答案

您是否已创建 SqlInsertCommand1 New 实例>在执行这些向其添加参数的行之前?

 Have you created a New instance of SqlInsertCommand1 before you execute these lines that add the parameters to it?


这篇关于必须声明标量变量@nCODE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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