コード例 #1
0
 private static void UpdateValue(string commandText)
 {
     using (OleDbConnection connection = ConnectionRepository.GetDataConnection()) {
         connection.Open();
         OleDbCommand cmd = new OleDbCommand(commandText, connection);
         cmd.ExecuteNonQuery();
     }
 }
コード例 #2
0
        public static DataTable GetCategories()
        {
            DataTable dataTableCategories = new DataTable();

            using (OleDbConnection connection = ConnectionRepository.GetDataConnection()) {
                OleDbDataAdapter adapter = new OleDbDataAdapter(string.Empty, connection);
                adapter.SelectCommand.CommandText = "SELECT [CategoryID], [CategoryName] FROM [Categories]";
                adapter.Fill(dataTableCategories);
            }
            return(dataTableCategories);
        }