Subject | Stored procedure thru C# |
---|---|
Author | Mahesh Ishwar |
Post date | 2003-07-23T06:26:48Z |
I'm executing my inline queries from C# code, and they are working fine. But as soon as convert them in stored procedure, and now try to execute these, it gives me 'unknown token <name of the stored procedure>'.
I've set the Command object type to stored procedure and command text to name of the stored procedure. Along with that I've also set the Parameters. I don't know whay it is giving me error.
Here is the code..
**********************************************************************
FbConnection myConnection = new FbConnection(connectionString);
myConnection.Open();
FbTransaction myTransaction = myConnection.BeginTransaction();
FbCommand fbCommand = new FbCommand();
fbCommand.Connection = myConnection;
fbCommand.Transaction = myTransaction;
stirng _commandString = "proc_migrate_data";
fbCommand.CommandText = _commandString;
fbCommand.CommandType = System.Data.CommandType.StoredProcedure;
FbParameter[] fbParameter = new FbParameter[2];
fbParameter[0] = new FbParameter("p_activity_id",FbType.VarChar);
fbParameter[0].Value = "871574628";
fbParameter[1] = new FbParameter("p_order_id",FbType.VarChar);
fbParameter[1].Value = "O596ba32b1ff8d8a4:25f3e5:f68a395d1f:-7faa";
fbParameter[2] = new FbParameter("p_success",FbType.Char);
fbParameter[2].Direction = System.Data.ParameterDirection.Output;
fbCommand.Parameters.Add(fbParameter[0]);
fbCommand.Parameters.Add(fbParameter[1]);
//fbCommand.Parameters.Add(fbParameter[2]);
int intNumberOfRecordsAffected = fbCommand.ExecuteNonQuery();
And teh signature of my stored procedure is
PROCEDURE proc_migrate_data(p_activity_id VARCHAR(255), p_order_id VARCHAR(255))
RETURNS (p_success CHAR(1)) AS BEGIN ... END
*************************************************************************
Has anyone faced this problem.
Thanx in advance.
Meghansh.
---------------------------------
Yahoo! Plus - For a better Internet experience
[Non-text portions of this message have been removed]
I've set the Command object type to stored procedure and command text to name of the stored procedure. Along with that I've also set the Parameters. I don't know whay it is giving me error.
Here is the code..
**********************************************************************
FbConnection myConnection = new FbConnection(connectionString);
myConnection.Open();
FbTransaction myTransaction = myConnection.BeginTransaction();
FbCommand fbCommand = new FbCommand();
fbCommand.Connection = myConnection;
fbCommand.Transaction = myTransaction;
stirng _commandString = "proc_migrate_data";
fbCommand.CommandText = _commandString;
fbCommand.CommandType = System.Data.CommandType.StoredProcedure;
FbParameter[] fbParameter = new FbParameter[2];
fbParameter[0] = new FbParameter("p_activity_id",FbType.VarChar);
fbParameter[0].Value = "871574628";
fbParameter[1] = new FbParameter("p_order_id",FbType.VarChar);
fbParameter[1].Value = "O596ba32b1ff8d8a4:25f3e5:f68a395d1f:-7faa";
fbParameter[2] = new FbParameter("p_success",FbType.Char);
fbParameter[2].Direction = System.Data.ParameterDirection.Output;
fbCommand.Parameters.Add(fbParameter[0]);
fbCommand.Parameters.Add(fbParameter[1]);
//fbCommand.Parameters.Add(fbParameter[2]);
int intNumberOfRecordsAffected = fbCommand.ExecuteNonQuery();
And teh signature of my stored procedure is
PROCEDURE proc_migrate_data(p_activity_id VARCHAR(255), p_order_id VARCHAR(255))
RETURNS (p_success CHAR(1)) AS BEGIN ... END
*************************************************************************
Has anyone faced this problem.
Thanx in advance.
Meghansh.
---------------------------------
Yahoo! Plus - For a better Internet experience
[Non-text portions of this message have been removed]