I have a VB.NET application that, as a part of this function, writes to an oracle database. When I launch the application the works perfectly fine for one iteration but, while the application is still open, if I attempt to write to the database again I get the following error.
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
And my Procedure in Oracle SQL is
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;
My VB.NET code is
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
It looks like you may not be re-initialising myCMD? So the number of parameters in the parameters collection goes up by two each time?
Try doing a
myCMD.Parameters.Count