Guest User

Untitled

a guest
Oct 31st, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using IBM.Data.Informix;
  6.  
  7. public class ContextConn
  8. {
  9. const string HOST = "10.0.12.4";
  10. const string SERVICENUM = "1504";
  11. const string SERVER = "teste";
  12. const string DATABASE = "db_Teste";
  13. const string USER = "admin";
  14. const string PASSWORD = "1234";
  15.  
  16. public IfxConnection conn = new IfxConnection();
  17.  
  18. public void MakeConnection()
  19. {
  20. string ConnectionString = "Host=" + HOST + "; " +
  21. "Service=" + SERVICENUM + "; " +
  22. "Server=" + SERVER + "; " +
  23. "Database=" + DATABASE + "; " +
  24. "User ID=" + USER + "; " +
  25. "Password=" + PASSWORD + "; ";
  26.  
  27. conn.ConnectionString = ConnectionString;
  28.  
  29. try
  30. {
  31. conn.Open();
  32. Console.WriteLine("Conectou");
  33. }
  34. catch (IfxException ex)
  35. {
  36. Console.WriteLine(ex);
  37. }
  38. }
  39.  
  40. public void CloseConnection()
  41. {
  42. conn.Close();
  43. }
  44. }
Add Comment
Please, Sign In to add comment