Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- System.ArgumentException: Keyword not supported. Parameter name: pwd at MySql.Data.MSqlClient.MySqlConnectionStringBuilder.ValidateKeyword (System.String keyword) [0x000000] in <filename unknown>:0
- NullReferenceException: A null value was found where an object instance was required.
- HandlerMySQL.Conectar ()
- using System.Collections.Generic;
- using System.Security.Cryptography;
- using MySql.Data;
- using MySql.Data.MySqlClient;
- public class HandlerMySQL{
- public string host, database, user, password;
- public bool pooling = true;
- private string connectionString;
- private static MySqlConnection con = null;
- private MySqlCommand cmd = null;
- private MySqlDataReader rdr = null;
- private MD5 _md5Hash;
- public HandlerMySQL(string h,string db, string u, string pw)
- {
- host = h;
- database = db;
- user = u;
- password = pw;
- }
- public void Conectar()
- {
- connectionString = "Server=" + host + ";Database=" + database + ";Uid=" + user + ";Pwd=" + password + ";Pooling=";
- if (pooling)
- {
- connectionString += "true;";
- }
- else
- {
- connectionString += "false;";
- }
- try
- {
- con = new MySqlConnection(connectionString);
- con.Open();
- Debug.Log("MySQL State: " + con.State);
- }
- catch(Exception e)
- {
- Debug.Log(e);
- Debug.Log("MySQL State: " + con.State);
- }
- }
- void OnApplicationQuit()
- {
- if (con != null)
- {
- if (con.State.ToString() != "Close")
- {
- con.Close();
- Debug.Log("MySQL Connection closed");
- }
- con.Dispose();
- }
- }
- public bool GetIsConnected()
- {
- if (con.State.ToString() == "Open")
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- public bool CreateData(string dnow, string dstart,int dend)
- {
- DataMySql data = new DataMySql(dnow, dstart, dend);
- if (DataToolsMySql.Agregar(data, con) > 0)
- {
- Debug.Log("Se agrego correctamente");
- return true;
- }
- else
- {
- Debug.Log("ERROR!!! No se agrego");
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement