Connection String Problem
I'm new to Visual Studio and MySQL. I'm creating a Login Page and connect it with MySQL. But whenever I add a connection string. I always got an error.
Can anybody tell me what's the problem in here?
Please.
This is my config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ODBCDriver" value="Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=timekeeping;uid=ro开发者_如何转开发ot;pwd=admin;Option=3;"/>
</appSettings>
<connectionStrings>
<add name="ConnectionString" connectionString="Database=timekeeping;uid=root;pwd=admin;Option=3;" />
</connectionStrings>
</configuration>
I'm not entirely familiar with MySQL connections, but your config file should look more like this
<configuration>
<appSettings>
<add key="ODBCDriver" value="Driver={MySQL ODBC 5.1 Driver};Server=localhost;"/>
</appSettings>
<connectionStrings>
<add name="ConnectionString" connectionString="Database=timekeeping;uid=root;pwd=admin;Option=3;" />
</connectionStrings>
</configuration>
You probably have a syntax error in your App.config
file.
Check the InnerException
for details.
This usually means there is a problem with your web.config file. Probably a tag out of place, not closed, or otherwise jacked.
http://msmvps.com/blogs/kevinmcneish/archive/2010/01/06/fixing-quot-configuration-system-failed-to-initalize-quot-exception.aspx
<configuration>
<appSettings>
<add key="ODBCDriver" value="Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=timekeeping;uid=root;pwd=admin;Option=3;"/>
</appSettings>
</configuration>
But whenever I add a connection string. I always got an error.
Your web.config or app.config configuration is not legal in its current form - this could be because of a typo, i.e an unclosed tag, otherwise malformed XML or a section that is unknown or nested in a section where it doesn't belong.
精彩评论