Пример #1
0
 public ConsoleDataSet.Startup_RecordsDataTable GetIdRange(int firstId, int lastId)
 {
     ConsoleDataSet.Startup_RecordsDataTable startTable = new ConsoleDataSet.Startup_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(startTable);
         sqlDataAdapter1.SelectCommand = sqlSelectCommand1;
     }
     finally
     {
         if (sqlConnection1.State != ConnectionState.Closed)
         {
             sqlConnection1.Close();
         }
         System.Threading.Monitor.Exit(sqlConnection1);                //Unlock the sqlconnection
     }
     return(startTable);
 }
Пример #2
0
        public override DataTable GetData(int start, int end)
        {
            ConsoleDataSet.Startup_RecordsDataTable table = null;

            try
            {
                table = ((ManStartupRecs)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);
        }
Пример #3
0
        private DateTime LoadSessionStartup(out string version)
        {
            version = "";
            DateTime startTime = DateTime.Now;

            ManStartupRecs man = new ManStartupRecs();

            man.SetDbName(Name.Replace(' ', '_'));
            int recordID = man.GetLastId();

            ConsoleDataSet.Startup_RecordsDataTable table = man.GetIdRange(recordID, recordID);
            if (table.Rows.Count == 1)
            {
                ConsoleDataSet.Startup_RecordsRow row = (ConsoleDataSet.Startup_RecordsRow)table.Rows[0];
                version   = row.Program_Version;
                startTime = row.Start_Time;
            }
            return(startTime);
        }