OKIEWARDOYO

C# No.40: 3

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