Answer the question
In order to leave comments, you need to log in
Calling a Procedure with Parameter Passing
after describing the connections...
try
{
connectionsql.Open();
connectionfirebird.Open();
cmdS.CommandText = "select ID_CASH from CAHS_TRANSACT";
SqlDataReader reader;
reader = cmdS.ExecuteReader();
while (reader.Read())
{
str = "execute procedure ART_DOC_INSERT (:ID_CASH, :DOCNUMB, :FLG)";
cmdF.CommandText = str;
cmdF.Parameters.Add("@ID_CASH", FbDbType.Integer).Value = reader.GetInt32(0);
cmdF.Parameters.Add("@DOCNUMB", FbDbType.BigInt).Value = DateTime.Now.ToString("yyMMddhhmm");
cmdF.Parameters.Add("@FLG", FbDbType.Integer).Value = "1";
try
{
cmdF.Prepare();
cmdF.ExecuteNonQuery();
cmdF.Parameters.Clear();
}
catch (Exception ex2)
{
Console.WriteLine(ex2.Message);
Console.ReadLine();
}
}
Answer the question
In order to leave comments, you need to log in
Based on this or this , the code will be like this:
str = "execute procedure ART_DOC_INSERT (:ID_CASH, :DOCNUMB, :FLG)";
cmdF.CommandText = str;
cmdF.Parameters.Add("ID_CASH", FbDbType.Integer).Value = reader.GetInt32(0);
cmdF.Parameters.Add("DOCNUMB", FbDbType.BigInt).Value = DateTime.Now.ToString("yyMMddhhmm");
cmdF.Parameters.Add("FLG", FbDbType.Integer).Value = "1";
Thanks, I'll take a look at the links, of course, but your code shows the same error!
thank! figured it out myself.
this is correct:
str = "execute procedure ART_DOC_INSERT (@ID_CASH, @DOCNUMB, @FLG)";
cmdF.CommandText = str;
cmdF.Parameters.Add("ID_CASH", FbDbType.Integer).Value = reader.GetInt32(0);
cmdF.Parameters.Add("DOCNUMB", FbDbType.BigInt).Value = DateTime.Now.ToString("yyMMddhhmm");
cmdF.Parameters.Add("FLG", FbDbType.Integer).Value = "1";
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question