So I'm using a connection string from my app.config file to connect to my database. I also tried to make it more secure, so that my SqlCOnnectionStringBuilder retrieves its info from the app.config file. To give you a better idea of what I mean here's some code:
app.config:
<connectionStrings>
<clear/>
<add name="connection"
connectionString="Data Source=SERVERIP; Initial Catalog=DB;
Port=3306; User ID=USERNAME; Password=PASSWORD;"
providerName="System.Data.SqlClient" />
</connectionStrings>
Method for the connection builder:
private void BuildConnectionString()
{
ConnectionStringSettings settings =
ConfigurationManager.ConnectionStrings["connection"];
if (null != settings)
{
MySqlConnectionStringBuilder builder =
new MySqlConnectionStringBuilder(settings.ConnectionString);
conString = builder.ConnectionString;
}
}
Somehow the user id gets replaced with the name of my computer, which is very wierd since the IP, port and the initial catalog aren't being replaced.
Oh and I followed this handy article here on MSDN.
Can someone please tell me what I'm doing wrong here?
EDIT: Here is the full error I'm getting:
An unhandled exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll
Additional information: Host 'nameofpc' is not allowed to connect to this MariaDB server