Asp.net Oracle ORA-01036无明显原因的非法变量名称/编号

Asp.net Oracle ORA-01036无明显原因的非法变量名称/编号,asp.net,sql,oracle,insert,Asp.net,Sql,Oracle,Insert,我创建了一个从ASP.NET Web表单中的网页调用的INSERT语句 当我试图执行我的查询时,我得到了以下信息:ORA-01036非法变量名/编号。不幸的是,我只有对数据库本身的只读访问权限,所以我无法测试他们的查询,因为它很孤独。下面是我的整个方法,因为我不确定问题是在查询中还是在参数中 public static String InsertIntoMiscReceiptCashTable( String Payeedetail,String LocationCode,

我创建了一个从ASP.NET Web表单中的网页调用的INSERT语句

当我试图执行我的查询时,我得到了以下信息:ORA-01036非法变量名/编号。不幸的是,我只有对数据库本身的只读访问权限,所以我无法测试他们的查询,因为它很孤独。下面是我的整个方法,因为我不确定问题是在查询中还是在参数中

 public static String InsertIntoMiscReceiptCashTable(
    String Payeedetail,String LocationCode, 
    String TransactionDate, String CashBookstoreCode, 
    String CashBookstoreSalesTaxCode, 
    String CashOther1DDL, String CashOther2DDl, 
    String CashOther1CommentTxt, String CashOther2CommentTxt,
    String CashCommentTxtBx, String RecapCashCommentTxtBx, 
    String RecapCheckNumCommentTxtBx,
    String RecapTotalCommentTxtBx, String RecapPymtRcvdCommentTxtBx, 
    String RecapChangeCommentTxtBx,
    String SysUserName, Double CashBookstoreAmountTxtBx, 
    Double CashBookstoreSalesTaxAmountTxtBx,
    Double CashOther1AmountTxtBx, Double CashOther2AmountTxtBx, 
    Double RecapCashAmountTxtBx,
    Double RecapCheckNumAmountTxtBx, Double RecapPymtRcvdAmountTxtBx, 
    Double RecapChangeAmountTxtBx,
    Double RecapTotalAmountTxtBx, Double CashTotalPaymentAmountTxtBx
    )
{
        DbLastKeySequence.addLastKeySequence("MISCRECEIPTSCASH.MISCRECEIPTID");
        int MiscReceiptID_lastKeySequence = 
          Convert.ToInt32(DbLastKeySequence.findLastKeySequence("MISCRECEIPTSCASH.MISCRECEIPTID"));

        String NextBatchNumber = ""; String NextReceiptNumber = "";
        DataTable NextValues = 
         DbCashMiscReceiptPg.Get_Description_NextBatchNum_NextReceiptNum(LocationCode);
        DataTableReader reader = NextValues.CreateDataReader();
        while (reader.Read())
        {
            NextBatchNumber = (reader["NEXTBATCHNUMBER"].ToString());
            NextReceiptNumber = (reader["NEXTRECEIPTNUMBER"].ToString());
        }
        reader.Close();

        String CommandText = "INSERT INTO MISCRECEIPTSCASH ( " + 
            "MISCRECEIPTID, " +
            "PAYEENAME, " +
            "TRANSACTIONDATE, " +
            "BATCHNUMBER, " +
            "RECEIPTNUMBER, " +
            "VOIDINDICATOR, " +
            "CASHTYPEPMTCODE1, " +
            "CASHCODE1, " +
            "CASHBOOKSTORECODE, " +
            "CASHSALESTAXCODE, " +
            "CASHOTHERCODE1, " +
            "CASHOTHERCODE2, " +
            "CASHOTHERCOMMENT1, " +
            "CASHOTHERCOMMENT2, " +
            "CHARGEBOOKSTORECODE, " +
            "LOCATIONCODE, " +
            "CASHCOMMENT, " +
            "RECAPCASHCOMMENT, " + 
            "RECAPCHECK1COMMENT, " +
            "RECAPTOTALCOMMENT, " +
            "RECAPPYMTRCVDCOMMENT," +
            "RECAPCHANGECOMMENT, " +
            "INITIALS, " +
            "CASHPAYMENTONACCOUNT1, " +
            "CASHPAYMENTONACCOUNT2, " +
            "CASHBOOKSTORE, " +
            "CASHSALESTAX, " +
            "CASHOTHERAMOUNT1," + 
            "CASHOTHERAMOUNT2, " +
            "CHARGEBOOKSTORE, " +
            "CHARGESALESTAX, " +
            "CHARGEOTHERAMOUNT, " +
            "RECAPCASHAMOUNT, " +
            "RECAPCHECK1AMOUNT,  " +
            "RECAPPYMTRCVDAMOUNT, " +
            "CHANGEAMT, " +
            "TOTALCHARGES, " +
            "TOTALRECAP, " +
            "TOTALPAYMENT, " +
            "GENERATEASCII, " +
            "GENERATEDDATE" +
            ")";

        CommandText += "VALUES ( " +
            ":MISCRECEIPTID, " +
            "':PayeeDetails', " +
            "TO_DATE(:TransactionDate,'yyyy-mm-dd HH24:MI:SS'), " +
            "':BatchNumber', " +
            "':ReceiptNumber', " +
            "'N', " +
            "'01', " +
            "'00012500', " +
            "':CashBookstoreCode', " +
            "':CashBookstoreSalesTaxCode', " +
            "':CashOther1DDL', " +
            "':CashOther2DDL', " +
            "':CashOther1CommentTxt'," +
            "':CashOther2CommentTxt'," +
            "':CashBookstoreCode', " +
            "':LocationCode', " +
            "':CashCommentTxtBx'," + 
            "':RecapCashCommentTxtBx'," + 
            "':RecapCheckNumCommentTxtBx'," + 
            "':RecapTotalCommentTxtBx'," +
            "':RecapPymtRcvdCommentTxtBx'," +
            "':RecapChangeCommentTxtBx'," +
            "':SysUserName'," +
            "0," +
            "0," +
            ":CashBookstoreAmountTxtBx," + 
            ":CashBkstreSalesTaxAmountTxtBx," + 
            ":CashOther1AmountTxtBx," +
            ":CashOther2AmountTxtBx," +
            "0, " +
            "0, " +
            "0, " +
            ":RecapCashAmountTxtBx, " +
            ":RecapCheckNumAmountTxtBx, " +
            ":RecapPymtRcvdAmountTxtBx," +
            ":RecapChangeAmountTxtBx," +
            "0, " +
            ":RecapTotalAmountTxtBx, " +
            ":CashTotalPaymentAmountTxtBx, " +
            "'N', " +
            "TO_DATE(:TransactionDate,'yyyy-mm-dd HH24:MI:SS') " +
            ")";

        cmd = new OracleCommand(CommandText, con);
        cmd.CommandType = CommandType.Text;

        cmd.Parameters.Clear();

        cmd.Parameters.AddWithValue(":MISCRECEIPTID", MiscReceiptID_lastKeySequence);
        cmd.Parameters.AddWithValue(":PayeeDetails", Payeedetail);
        cmd.Parameters.AddWithValue(":TransactionDate", TransactionDate);
        cmd.Parameters.AddWithValue(":BatchNumber", NextBatchNumber);
        cmd.Parameters.AddWithValue(":ReceiptNumber", NextReceiptNumber);
        cmd.Parameters.AddWithValue(":CashBookstoreCode", CashBookstoreCode); // Same as down there
        cmd.Parameters.AddWithValue(":CashBookstoreSalesTaxCode", CashBookstoreSalesTaxCode);
        cmd.Parameters.AddWithValue(":CashOther1DDL", CashOther1DDL);
        cmd.Parameters.AddWithValue(":CashOther2DDL", CashOther2DDl);
        cmd.Parameters.AddWithValue(":CashOther1CommentTxt", CashOther1CommentTxt);
        cmd.Parameters.AddWithValue(":CashOther2CommentTxt", CashOther2CommentTxt);
        //cmd.Parameters.AddWithValue(":CashBookstoreCode", CashBookstoreCode); // Same as up there 
        cmd.Parameters.AddWithValue(":LocationCode", LocationCode);
        cmd.Parameters.AddWithValue(":CashCommentTxtBx", CashCommentTxtBx);
        cmd.Parameters.AddWithValue(":RecapCashCommentTxtBx", RecapCashCommentTxtBx);
        cmd.Parameters.AddWithValue(":RecapCheckNumCommentTxtBx", RecapCheckNumCommentTxtBx);
        cmd.Parameters.AddWithValue(":RecapTotalCommentTxtBx", RecapTotalCommentTxtBx);
        cmd.Parameters.AddWithValue(":RecapPymtRcvdCommentTxtBx", RecapPymtRcvdCommentTxtBx);
        cmd.Parameters.AddWithValue(":RecapChangeCommentTxtBx", RecapChangeCommentTxtBx);
        cmd.Parameters.AddWithValue(":SysUserName", SysUserName);
        cmd.Parameters.AddWithValue(":CashBookstoreAmountTxtBx", CashBookstoreAmountTxtBx);
        cmd.Parameters.AddWithValue(":CashBkstreSalesTaxAmountTxtBx", CashBookstoreSalesTaxAmountTxtBx);
        cmd.Parameters.AddWithValue(":CashOther1AmountTxtBx", CashOther1AmountTxtBx);
        cmd.Parameters.AddWithValue(":CashOther2AmountTxtBx", CashOther2AmountTxtBx);
        cmd.Parameters.AddWithValue(":RecapCashAmountTxtBx", RecapCashAmountTxtBx);
        cmd.Parameters.AddWithValue(":RecapCheckNumAmountTxtBx", RecapCheckNumAmountTxtBx);
        cmd.Parameters.AddWithValue(":RecapPymtRcvdAmountTxtBx", RecapPymtRcvdAmountTxtBx);
        cmd.Parameters.AddWithValue(":RecapChangeAmountTxtBx", RecapChangeAmountTxtBx);
        cmd.Parameters.AddWithValue(":RecapTotalAmountTxtBx", RecapTotalAmountTxtBx);
        cmd.Parameters.AddWithValue(":CashTotalPaymentAmountTxtBx", CashTotalPaymentAmountTxtBx);

        con.Open();
        cmd.ExecuteNonQuery();

        cmd.Parameters.Clear();

        con.Close();
        return NextReceiptNumber;

}// end db insert query
我已经检查了所有列的名称,它们都是正确的。我还检查了所有的参数名(复制和粘贴),它们都是正确的(除非我疯了)。我还检查了它们所有的数据类型——同样都很好。在设置参数值时,我还去掉了所有参数的冒号(:),但仍然得到了错误


如果有人知道我为什么老是犯这个错误,我们将非常感谢你的帮助

不确定这是否是错误的原因,但参数占位符肯定不应该用单引号括起来。这样它们就变成了文字字符串

例如(但不仅限于此)

应该是

 ":BatchNumber, "

那把它修好了!!多谢各位
 ":BatchNumber, "