Guest User

Untitled

a guest
Feb 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. // Main.cs created with MonoDevelop
  2. // User: mariuz at 12:37 PM 9/12/2008
  3. //
  4. // To change standard headers go to Edit->Preferences->Coding->Standard Headers
  5. using System;
  6. using System.Data;
  7. using FirebirdSql.Data.Firebird;
  8.  
  9.  
  10.  
  11. namespace firebirdtest
  12. {
  13. class MainClass
  14. {
  15. public static void Main(string[] args) {
  16. string connectionString =
  17. "Database=/var/lib/firebird/2.1/data/employee.fdb;" +
  18. "User=SYSDBA;" + "Password=masterkey;" +
  19. "Dialect=3;character set=NONE;" + "Server=localhost";
  20. IDbConnection dbcon = new FbConnection(connectionString);
  21. dbcon.Open();
  22. IDbCommand dbcmd = dbcon.CreateCommand();
  23. string sql = "SELECT * FROM employee";
  24. dbcmd.CommandText = sql;
  25. IDataReader reader = dbcmd.ExecuteReader();
  26. while(reader.Read()) {
  27. object dataValue = reader.GetValue(0);
  28. string sValue = dataValue.ToString();
  29. Console.WriteLine("Value: " + sValue);
  30. }
  31. // clean up
  32. reader.Close();
  33. reader = null;
  34. dbcmd.Dispose();
  35. dbcmd = null;
  36. dbcon.Close();
  37. dbcon = null;
  38. }
  39.  
  40. }
  41. }
Add Comment
Please, Sign In to add comment