Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. System.ArgumentException: Keyword not supported. Parameter name: pwd at MySql.Data.MSqlClient.MySqlConnectionStringBuilder.ValidateKeyword (System.String keyword) [0x000000] in <filename unknown>:0
  2.  
  3. NullReferenceException: A null value was found where an object instance was required.
  4. HandlerMySQL.Conectar ()
  5.  
  6. using System.Collections.Generic;
  7. using System.Security.Cryptography;
  8. using MySql.Data;
  9. using MySql.Data.MySqlClient;
  10.  
  11. public class HandlerMySQL{
  12.  
  13. public string host, database, user, password;
  14. public bool pooling = true;
  15.  
  16. private string connectionString;
  17. private static MySqlConnection con = null;
  18. private MySqlCommand cmd = null;
  19. private MySqlDataReader rdr = null;
  20.  
  21.  
  22. private MD5 _md5Hash;
  23. public HandlerMySQL(string h,string db, string u, string pw)
  24. {
  25. host = h;
  26. database = db;
  27. user = u;
  28. password = pw;
  29. }
  30. public void Conectar()
  31. {
  32.  
  33. connectionString = "Server=" + host + ";Database=" + database + ";Uid=" + user + ";Pwd=" + password + ";Pooling=";
  34.  
  35.  
  36. if (pooling)
  37. {
  38. connectionString += "true;";
  39. }
  40. else
  41. {
  42. connectionString += "false;";
  43. }
  44. try
  45. {
  46. con = new MySqlConnection(connectionString);
  47. con.Open();
  48. Debug.Log("MySQL State: " + con.State);
  49.  
  50. }
  51. catch(Exception e)
  52. {
  53. Debug.Log(e);
  54. Debug.Log("MySQL State: " + con.State);
  55. }
  56. }
  57.  
  58. void OnApplicationQuit()
  59. {
  60. if (con != null)
  61. {
  62. if (con.State.ToString() != "Close")
  63. {
  64. con.Close();
  65. Debug.Log("MySQL Connection closed");
  66. }
  67. con.Dispose();
  68. }
  69. }
  70.  
  71.  
  72. public bool GetIsConnected()
  73. {
  74. if (con.State.ToString() == "Open")
  75. {
  76. return true;
  77. }
  78. else
  79. {
  80. return false;
  81. }
  82. }
  83.  
  84. public bool CreateData(string dnow, string dstart,int dend)
  85. {
  86. DataMySql data = new DataMySql(dnow, dstart, dend);
  87. if (DataToolsMySql.Agregar(data, con) > 0)
  88. {
  89. Debug.Log("Se agrego correctamente");
  90. return true;
  91. }
  92. else
  93. {
  94. Debug.Log("ERROR!!! No se agrego");
  95. return false;
  96. }
  97. }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement