Exemplo n.º 1
0
        public ConsoleDataSet.FTP_RecordsDataTable GetIdRange(int firstId, int lastId)
        {
            ConsoleDataSet.FTP_RecordsDataTable ftpTable = new ConsoleDataSet.FTP_RecordsDataTable();
            sqlSELECTbyID.Parameters["@FirstID"].Value = firstId;
            sqlSELECTbyID.Parameters["@LastID"].Value  = lastId;
            try
            {
                System.Threading.Monitor.Enter(sqlConnection1);                //Lock the sqlconnection
                if (sqlConnection1.State == ConnectionState.Closed)
                {
                    sqlConnection1.Open();
                }
                sqlDataAdapter1.SelectCommand = sqlSELECTbyID;
                sqlDataAdapter1.Fill(ftpTable);
                sqlDataAdapter1.SelectCommand = sqlSelectCommand1;
            }
            finally
            {
                if (sqlConnection1.State != ConnectionState.Closed)
                {
                    sqlConnection1.Close();
                }
                System.Threading.Monitor.Exit(sqlConnection1);                //Unlock the sqlconnection
            }

            return(ftpTable);
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        public override DataTable GetData(int start, int end)
        {
            ConsoleDataSet.FTP_RecordsDataTable table = null;

            try
            {
                table = ((ManFtpRecs)manager).GetIdRange(start, end);
            }
            catch (System.Data.SqlClient.SqlException sqle)
            {
                Debug.WriteLine("SQL Exception - " + sqle.Message);
                Status = new StatusEventArgs(635, StatusEventArgs.SEVERE, sqle.Message);
            }

            return(table);
        }