OKIEWARDOYO

VISUAL C# No.39 4

Feb 17th, 2014
4,203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1.  
  2.  
  3.         private void LoadingData()
  4.         {
  5.             this.makeConnection();
  6.  
  7.             Console.WriteLine("\nBegin loading data...");
  8.  
  9.             try
  10.             {
  11.                 OleDbCommand command = new OleDbCommand("SELECT * FROM TablePerson", connection);
  12.                 OleDbDataAdapter adapter = new OleDbDataAdapter(command);
  13.                 DataTable table = new DataTable();
  14.  
  15.                 adapter.Fill(table);
  16.  
  17.                 dataGridView1.DataSource = table;
  18.  
  19.                 Console.WriteLine("Success loading data...");
  20.  
  21.                 this.closeConnection();
  22.  
  23.             }
  24.             catch (Exception ex)
  25.             {
  26.                 Console.WriteLine("Failed to load data :: " + ex.Message);
  27.             }
  28.         }
Advertisement
Add Comment
Please, Sign In to add comment