Click here to Skip to main content
15,912,932 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
XML
<b><pre lang="xml">
<?xml version="1.0" encoding="utf-8" ?>

<configuration>
  <configSections>
  </configSections>
  <connectionStrings>
    <Data Source="TISATASNIM-PC\SQLEXPRESS;Initial" Catalog="ImageViewer;Integrated" Security="True"/>

  </connectionStrings>
    <!--   User application and configured property settings go here.-->
    <!--   Example: <add key="settingName" value="settingValue"/> -->
  <!--Data Source="TISATASNIM-PC\SQLEXPRESS;Initial" Catalog="ImageViewer;Integrated" Security="True"/-->



  <system.net>
    <mailSettings>
      <smtp deliveryMethod="PickupDirectoryFromIis">
        <network defaultCredentials="true" host="localhost" port="587"/>
      </smtp>
    </mailSettings>
  </system.net>
</configuration></pre></b>
Getting error in Data Sourch.


Error: The connection string property is not initialize...
Posted
Updated 8-Jul-12 8:19am
v2
Comments
[no name] 8-Jul-12 15:46pm    
That error means that you tried to use a connection that the connection string was not initialized. In other words, you failed to read the connection string from your config file.

You need to add connection string in correct place and correct format.

I'm mot going to give you answer directly. read below links and you can learn how you can do it.

http://msdn.microsoft.com/en-us/library/ms254494(v=vs.80).aspx[^]
http://www.connectionstrings.com/Articles/Show/store-connection-string-in-web-config[^]
http://www.connectionstrings.com/sql-server-2005[^]
 
Share this answer
 
You can write connection string in following manner :

C#
 <add name="connection" connectionstring="Data Source=TISATASNIM-PC\SQLEXPRESS;Initial Catalog=ImageViewer;Integrated Security=True">
providerName = "System.Data.SqlClient"/>   
</add>
 
Share this answer
 
First Check You Connection String
Insted of
XML
<data source="TISATASNIM-PC\SQLEXPRESS;Initial" catalog="ImageViewer;Integrated" security="True" />
 <data source="TISATASNIM-PC\SQLEXPRESS;Initial Catalog=ImageViewer;Integrated Security=True" />

Write Connection string like this
XML
<add name="con1" connectionstring="Data Source=IICSS20\PMIS;Initial Catalog=PMA170711;Integrated Security=True <br mode=" hold=" />        providerName=" system.data.sqlclient=" /><br mode=" con="].ConnectionString);</xml>"></add>

IN Code Behind:

Load Connection string like this:
C#
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString);
 
Share this answer
 
v2

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