0

Hai,I am trying to connection using web.confing in connectionstring element
and i have written below code in connectionstring element in

<connectionStrings>
      <add name="DB1" connectionString="Data Source=DEV5\\SQLEXPRESS;Initial Catalog=icondatabase;Integrated Security=True" />
      </connectionStrings>

And in the .aspx.cs file (in Load_page)i have written below code

string connection= ConfigurationManager.ConnectionStrings["DB1"].ToString();
      SqlConnection cn = new SqlConnection("connection");

while i compiled page it give the error:
"
ArgumentExeption was Unhandled by User Code
Format of the initialization string does not conform to specification starting at index 0."

any body plz help me......

2
Contributors
2
Replies
5
Views
7 Years
Discussion Span
Last Post by Pari13
0

Remove double quotes.

...
 SqlConnection cn = new SqlConnection(connection);

thanks it run....successfully.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.