Click here to Skip to main content
15,843,200 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
    <add key="ohpc_connectionstring" value="SERVER=;User Id=root;pwd=password;database=ohpc_new1;Persist Security Info=True" />

I have declare this code in app.config file but It does not work properly and show error message. So how can I modify the code to access mysql database from our remote server. For mysql database userid =root but we have not set any password for database.

[edit]Code block and HTML encode added to make code fragment visible! - OriginalGriff[/edit]
Updated 28-Aug-12 23:34pm
OriginalGriff 29-Aug-12 4:36am    
When you post a question (or answer) please check the preview - if you don't encode HTML tag characters then the client browser will "swallow" them, hiding all your code fragment! I have fixed it for you here - have a look with the "Improve question" widget and you will see what I mean.
Sarrrva 29-Aug-12 4:42am

Hi Dear,

try this code in app.config file

<?xml version="1.0"?>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    <add name="SqlServerConnectionstring" connectionString="Password=password;Connection Timeout=0;Persist Security Info=False;User ID=userid;Initial Catalog=Database Name;Data Source=servername;" />

in C# form page use the following code to acces the SqlServerConnectionstring

Share this answer
        <add key ="Connstr" value="SERVER=\SQLExpress;
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900