示例#1
0
        public List <GuideToOperation> Load()
        {
            List <GuideToOperation> guideToOperations = new List <GuideToOperation>();

            SQLiteConnection sqlite_conn;
            SQLiteCommand    sqlite_cmd;
            SQLiteDataReader sqlite_datareader;

            sqlite_conn = new SQLiteConnection(DataProvider.SQLiteConnectionString);
            sqlite_conn.Open();
            sqlite_cmd = sqlite_conn.CreateCommand();

            StringBuilder commandText = new StringBuilder();

            commandText.Append("SELECT Индекс, Содержание FROM СправочникОпераций");
            sqlite_cmd.CommandText = commandText.ToString();
            sqlite_datareader      = sqlite_cmd.ExecuteReader();

            while (sqlite_datareader.Read())
            {
                GuideToOperation guideToOperation = new GuideToOperation(sqlite_datareader["Содержание"].ToString());
                guideToOperation.SetInternalIndex(Convert.ToInt32(sqlite_datareader["Индекс"]));
                guideToOperations.Add(guideToOperation);
            }

            sqlite_datareader.Close();
            sqlite_conn.Close();
            return(guideToOperations);
        }
示例#2
0
        public List <GuideToOperation> LoadGuideToOperations()
        {
            List <GuideToOperation> guideToOperations = new List <GuideToOperation>();
            OleDbConnection         myOleDbConnection = new OleDbConnection(connectionString);
            OleDbCommand            myOleDbCommand    = myOleDbConnection.CreateCommand();

            myOleDbCommand.CommandText = "SELECT * FROM Справочник";

            myOleDbConnection.Open();

            OleDbDataReader myOleDbDataReader = myOleDbCommand.ExecuteReader();

            while (myOleDbDataReader.Read())
            {
                GuideToOperation guideToOperation = new GuideToOperation(myOleDbDataReader["Название"].ToString());
                guideToOperation.SetInternalIndex(Convert.ToInt32(myOleDbDataReader["Номер"]));
                guideToOperations.Add(guideToOperation);
            }

            myOleDbDataReader.Close();
            myOleDbConnection.Close();
            return(guideToOperations);
        }