1.  The exception is index has to be within the length of paramteter.
2.  When i reverted back to the earlier build of 10 Sep 2010, there was no
problem.
3.  For your reference please, the code in question follows :-

        void BtnFeedClick(object sender, EventArgs e)
        {
            rtbMsg.Text="";

            //Is the user allowed ?
            string strCmd=string.Format("SELECT p.OP_YES FROM
ZPATHO_ALLOW_USR_ENTER_PT_RPTS ('{0}') p",Loggin.UserName);
            Dictionary<string, string> dic = HISCtrls.
ONERecordSetInDictionary(null,null,strCmd,rtbMsg,this);
            if(Convert.ToInt16(dic["OP_YES"]) == 0)
            {
                MessageBox.Show("Not authorized.","Attention");
                return;
            }

            //Feed values
            DataTable dtFeed = new DataTable();
            dtFeed.Columns.Add("SERVICEID",typeof(Int32));
            dtFeed.Columns.Add("TESTID",typeof(Int32));
            dtFeed.Columns.Add("REGDID",typeof(Int64));
            dtFeed.Columns.Add("DECVAL",typeof(decimal));
            dtFeed.Columns.Add("TXTVAL",typeof(string));
            dtFeed.Columns.Add("RPTTIME",typeof(DateTime));
            dtFeed.Columns.Add("REMARKS",typeof(string));
            dtFeed.Columns.Add("ENTEREDBY",typeof(string));
            dtFeed.Columns.Add("ENTRYPC",typeof(string));
            dtFeed.Columns.Add("ENTRYTIME",typeof(DateTime));
            dtFeed.Columns.Add("IS_DFLT",typeof(Int16));

            object[] objArr;
            for(int i = 0;i<dgvFeed.Rows.Count;i++)
            {
                if(dgvFeed.Rows[i].DefaultCellStyle.BackColor==Color.
LightBlue && dgvFeed["RPTTIME",i].Value != DBNull.Value)
                {

                    objArr = new object[]{
                        dgvFeed["REPORTID",i].Value,
                        dgvFeed["TESTID",i].Value,
                        CurPtIDs.RegdID,
                        dgvFeed["VAL",i].Value,
                        dgvFeed["TEXT VAL",i].Value,
                        dgvFeed["RPTTIME",i].Value,
                        dgvFeed["REMARKS",i].Value,
                        Loggin.UserName,
                        Loggin.UserPC,
                        DateTime.Now,
                        dgvFeed["IS_DFLT",i].Value
                    };
                    dtFeed.Rows.Add(objArr);
                    //dtFeed.Rows[i].SetAdded();
                }
            }

            FbConnection con = new FbConnection(Loggin.csb.ConnectionString
);

             con.Open();
             FbTransaction tx = con.BeginTransaction();
            try
            {

                FbCommand comSel = con.CreateCommand();
                comSel.CommandText="SELECT * FROM ZPATHO_RPTS_OF_PATIENT";
                comSel.Transaction=tx;

                 FbDataAdapter da = new FbDataAdapter(comSel);

                 FbCommand comIns = con.CreateCommand();
                 comIns.CommandText="ZPATHO_INSERT_PT_RPTS";
                 comIns.CommandType = CommandType.StoredProcedure;
                 comIns.UpdatedRowSource = UpdateRowSource.OutputParameters;
                 comIns.Transaction=tx;

                 //SELECT p.MSG FROM ZPATHO_INSERT_PT_RPTS
                 //(SERVICEID, TESTID, REGDID, DECVAL, TXTVAL, RPTTIME,
REMARKS, ENTEREDBY, ENTRYPC, ENTRYTIME, IS_DFLT) p
                 comIns.Parameters.Add("SERVICEID",FbDbType.Integer,4,
"SERVICEID");
                 comIns.Parameters.Add("TESTID",FbDbType.Integer,4,"TESTID"
);
                 comIns.Parameters.Add("REGDID",FbDbType.BigInt,8,"REGDID");
                 comIns.Parameters.Add("DECVAL",FbDbType.Decimal,8,"DECVAL"
);
                 comIns.Parameters.Add("TXTVAL",FbDbType.VarChar,200,
"TXTVAL");
                 comIns.Parameters.Add("RPTTIME",FbDbType.TimeStamp,8,
"RPTTIME");
                 comIns.Parameters.Add("REMARKS",FbDbType.VarChar,200,
"REMARKS");

                 comIns.Parameters.Add("ENTEREDBY",FbDbType.VarChar,80,
"ENTEREDBY");
                 comIns.Parameters.Add("ENTRYPC",FbDbType.VarChar,80,
"ENTRYPC");
                 comIns.Parameters.Add("ENTRYTIME",FbDbType.TimeStamp,8,
"ENTRYTIME");
                 comIns.Parameters.Add("IS_DFLT",FbDbType.SmallInt,2,
"IS_DFLT");

                 da.InsertCommand=comIns;

                 da.Update(dtFeed);
                 da.Dispose();
                 dtFeed.Dispose();
                 comSel.Dispose();
                 comIns.Dispose();

                 tx.Commit();
            }
            catch (FbException ex)
            {
                if(tx != null)
                {
                    tx.Rollback();
                    tx.Dispose();
                    tx = null;
                }
                rtbMsg.Text=ex.Message;
            }
            catch (Exception ex)
            {
                rtbMsg.Text=ex.Message;
            }
            finally
            {
                con.Close();
            }

            btnFeed.Enabled=false;
            btnRefreshFeed.Enabled=true;
        }
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to