Advertisement
klokotnitza

Untitled

Nov 24th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. static void Main(string[] args)
  2. {
  3. const string ConnectionString = @"
  4. User=SYSDBA;Password=masterkey;
  5. Database=D:\\firebird\KCRM.FDB;DataSource=localhost;
  6. Port=3050;Dialect=3;Charset=NONE;Role=;Connection lifetime=15;Pooling=true;
  7. MinPoolSize=0;MaxPoolSize=50;Packet Size=8192;ServerType=0;";
  8.  
  9. string fbSelectCommand = @"select USER_NAME from USERS";
  10. using (FbConnection con = new FbConnection(ConnectionString))
  11. {
  12. con.Open();
  13. Console.WriteLine("Reading from FireBird DB query - {0}", fbSelectCommand);
  14.  
  15. using (FbCommand fbCommand = new FbCommand(fbSelectCommand, con))
  16. {
  17. using (FbDataReader reader = fbCommand.ExecuteReader())
  18. {
  19. if (reader != null)
  20. {
  21. while (reader.Read())
  22. {
  23.  
  24. string userName = (string)reader["USER_NAME"];
  25. Console.WriteLine("{0}", userName);
  26. }
  27. }
  28. }
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement