0

我有一个 VB.NET 应用程序,作为这个函数的一部分,它写入一个 oracle 数据库。当我启动应用程序时,一次迭代的工作非常好,但是,当应用程序仍然打开时,如果我再次尝试写入数据库,我会收到以下错误。

 ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'INSERTINTORACOSENT'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

我在 Oracle SQL 中的过程是

create or replace
PROCEDURE     insertintoracosent(
    p_phone            IN RACOSENT.PHONE%TYPE,
    p_msg              IN RACOSENT.MESSAGE%TYPE)
IS
BEGIN
  INSERT INTO racosent
  VALUES (seq_sent.nextval, p_phone, p_msg, sysdate);
END;

我的 VB.NET 代码是

 Sub orclSendSMS(ByRef cbManNum As String, ByRef cbManMsg As String)
    If orcl.State = ConnectionState.Closed Then orcl.Open()
    myCMD.Connection = orcl
    myCMD.CommandText = "insertintoracosent"
    myCMD.CommandType = CommandType.StoredProcedure
    Dim num As OracleParameter = New OracleParameter("p_phone", OracleDbType.Int64, ParameterDirection.Input)
    Dim msg As OracleParameter = New OracleParameter("p_msg", OracleDbType.Varchar2, ParameterDirection.Input)
    num.Value = Convert.ToInt64(cbManNum)
    msg.Value = cbManMsg
    myCMD.Parameters.Add(num)
    myCMD.Parameters.Add(msg)
    Try
        myCMD.ExecuteNonQuery()
    Catch ex As Exception
        MsgBox(ex.ToString)
        Exit Sub
    End Try
End Sub
4

1 回答 1

2

看起来您可能没有重新初始化 myCMD?那么参数集合中的参数数量每次增加两个?

尝试做一个myCMD.Parameters.Count

于 2012-10-18T19:49:35.043 回答