0

This did not worked when I ran the program!

using MySql.Data; using MySql.Data.MySqlClient; namespace MySQL { class SqlConnection { public SqlConnection() { } ~SqlConnection() { } private string strConnection = "Server=localhost;Database=database;Port=3306;User ID=root;Password="; private MySqlConnection connection; public void OpenConnection() { connection = new MySqlConnection(); connection.Open(); } public void CloseConnection() { connection.Close(); connection.Dispose(); } public string StrConnection { set { StrConnection = value; } get { return StrConnection; } } } } 

but it is not working!

ERROR : host 'xxx' is not allowed to connect to this MariaDB sever!

0

1 Answer 1

3

You don't use the connection string property strConnection, when you initialize your connection. Try:

public void OpenConnection() { connection = new MySqlConnection(strConnection); connection.Open(); } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.