Anyname Donotcare
Anyname Donotcare

Reputation: 11403

ERROR [HY090] [Informix .NET provider]Invalid string or buffer length.

I get the following exception :

"ERROR [HY090] [Informix .NET provider]Invalid string or buffer length."

When i try to to call the following method :

  public static int PrepareSal(int year, int month, int calcYear)
        {
            using (IfxConnection con = new IfxConnection(ConfigurationManager.ConnectionStrings["testable"].ToString()))
            {
                int res = 0;
                StringBuilder cmdTxt = new StringBuilder();
                cmdTxt.Append("hkr_calc");
                using (var myIfxCmd = new IfxCommand(cmdTxt.ToString(), con))
                {
                    myIfxCmd.CommandType = CommandType.StoredProcedure;

                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                    }
                    myIfxCmd.Parameters.Clear();
                    myIfxCmd.Parameters.Add("p_year", IfxType.Integer, year);
                    myIfxCmd.Parameters.Add("p_month", IfxType.Integer, month);
                    myIfxCmd.Parameters.Add("p_calc_year", IfxType.Integer, calcYear);
                 //   myIfxCmd.CommandTimeout = 15000;
                    res = myIfxCmd.ExecuteNonQuery(); //exception
                }
                con.Close();
                con.Dispose();
                return res;
            }
        }

When i call the procedure in my sql editor it works fine , but it takes about 10 minutes !

Upvotes: 0

Views: 1251

Answers (1)

Tony Hopkinson
Tony Hopkinson

Reputation: 20320

Would have expected cmdTxt.append(hkr_calc @p_year, @p_month, @p_calc_year) or some such. ? marks maybe place holders for the parameters anyway.

PS you don't need the close or dispose on con as its in a using block, and it's always going to be closed initially, unless you've stuffed up the connection pooling.

Upvotes: 1

Related Questions