}//fin FormEvent

        private void ActualizarRegistros()
        {
            TFunctions     Reg;
            SqlDataAdapter Adapter;
            SqlConnection  ConexionADO;
            DataSet        cDataSet;
            String         sCnn;
            int            lRetCode;
            String         User, Pass;

            try
            {
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select TOP 1 * from [@VID_FEPARAM]";
                }
                else
                {
                    s = @"select TOP 1 * from ""@VID_FEPARAM""";
                }

                oRecordSet.DoQuery(s);
                if (oRecordSet.RecordCount > 0)
                {
                    Reg       = new TFunctions();
                    Reg.SBO_f = FSBOf;
                    User      = Reg.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_Usuario").Value));
                    Pass      = Reg.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_Password").Value));
                    sCnn      = Reg.sConexion((System.String)(oRecordSet.Fields.Item("U_Servidor").Value), (System.String)(oRecordSet.Fields.Item("U_Base").Value), User, Pass);
                    if (sCnn.Substring(0, 1) != "E")
                    {
                        ConexionADO = new SqlConnection(sCnn);
                        if (ConexionADO.State == ConnectionState.Closed)
                        {
                            ConexionADO.Open();
                        }

                        if (GlobalSettings.RunningUnderSQLServer)
                        {
                            s = @"SELECT T0.DocEntry, T1.VisOrder, T0.U_TipoDoc, T1.U_Folio, T1.LineId
                                  FROM [@VID_FEDIST] T0 WITH(nolock)
                                  JOIN [@VID_FEDISTD] T1 WITH(nolock) ON T1.DocEntry = T0.DocEntry
                                 WHERE T1.U_Estado = 'D'
                                   AND T0.U_Sucursal <> 'Principal'
                                ";
                        }
                        else
                        {
                            s = @"SELECT T0.""DocEntry"", T1.""VisOrder"", T0.""U_TipoDoc"", T1.""U_Folio"", T1.""LineId""
                                  FROM ""@VID_FEDIST"" T0
                                  JOIN ""@VID_FEDISTD"" T1 ON T1.""DocEntry"" = T0.""DocEntry""
                                 WHERE T1.""U_Estado"" = 'D'
                                   AND T0.""U_Sucursal"" <> 'Principal'";
                        }

                        oRecordSet.DoQuery(s);
                        ConexionADO = new SqlConnection(sCnn);
                        if (ConexionADO.State == ConnectionState.Closed)
                        {
                            ConexionADO.Open();
                        }

                        while (!oRecordSet.EoF)
                        {
                            var VID_SP_EXISTEFOLIO = new SqlCommand("VID_SP_EXISTEFOLIO", ConexionADO);
                            var oParameter         = new SqlParameter();
                            VID_SP_EXISTEFOLIO.CommandType = CommandType.StoredProcedure;
                            oParameter       = VID_SP_EXISTEFOLIO.Parameters.Add("@TipoDoc", SqlDbType.VarChar, 10);
                            oParameter.Value = (System.String)(oRecordSet.Fields.Item("U_TipoDoc").Value);
                            oParameter       = VID_SP_EXISTEFOLIO.Parameters.Add("@FolioNum", SqlDbType.Int);
                            oParameter.Value = (System.Double)(oRecordSet.Fields.Item("U_Folio").Value);

                            Adapter  = new SqlDataAdapter(VID_SP_EXISTEFOLIO);
                            cDataSet = new DataSet(VID_SP_EXISTEFOLIO.CommandText);
                            Adapter.Fill(cDataSet);
                            s = (System.String)(cDataSet.Tables[0].Rows[0][0].ToString()).Trim();

                            if (s == "Y")
                            {
                                s        = Convert.ToString((System.Int32)(oRecordSet.Fields.Item("DocEntry").Value));
                                s        = Convert.ToString((System.Int32)(oRecordSet.Fields.Item("LineId").Value));
                                s        = Convert.ToString((System.Double)(oRecordSet.Fields.Item("U_Folio").Value));
                                lRetCode = Reg.ActEstadoFolioUpt((System.Int32)(oRecordSet.Fields.Item("DocEntry").Value), (System.Int32)(oRecordSet.Fields.Item("LineId").Value), (System.Double)(oRecordSet.Fields.Item("U_Folio").Value), (System.String)(oRecordSet.Fields.Item("U_TipoDoc").Value), "", "", "");
                                lRetCode = 1;
                                if (lRetCode == 0)
                                {
                                    FSBOApp.StatusBar.SetText("No se ha actualizado estado de Folio " + Convert.ToString((System.Double)(oRecordSet.Fields.Item("U_Folio").Value)), BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                                    OutLog("No se ha actualizado estado de Folio " + Convert.ToString((System.Double)(oRecordSet.Fields.Item("U_Folio").Value)));
                                }
                            }

                            VID_SP_EXISTEFOLIO = null;

                            oRecordSet.MoveNext();
                        }

                        if (ConexionADO.State == ConnectionState.Open)
                        {
                            ConexionADO.Close();
                        }

                        Grilla();

                        if (ConexionADO.State == ConnectionState.Open)
                        {
                            ConexionADO.Close();
                        }

                        FSBOApp.StatusBar.SetText("Estado de Folios actualizados", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                    }
                    else
                    {
                        FSBOApp.StatusBar.SetText("Faltan datos Conexion. " + sCnn.Substring(1, sCnn.Length - 1), BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                    }
                }
                else
                {
                    FSBOApp.StatusBar.SetText("Debe ingresar datos de conexion", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                }
            }
            catch (Exception e)
            {
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
                OutLog("GuardarRegistros: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin ActualizarRegistros