Click here to Skip to main content
15,887,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to export my database as .Net SqlClient Data Provider format but I keep getting this error message:

The operation could not be completed ADDITIONAL INFORMATION: The ConnectionString property has not been initialized. (System.Data)

Program Location: code:

       at System.Data.SqlClient.SqlConnection.PermissionDemand()
       at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.SqlClient.SqlConnection.Open()
       at Microsoft.SqlServer.Dts.DtsWizard.DTSWizard.GetOpenedConnection(WizardInputs wizardInputs, String connEntryName)
       at Microsoft.SqlServer.Dts.DtsWizard.Step2.OnLeavePage(LeavePageEventArgs e)


but my app config has the connection string declared as

code:
HTML
<configuration>
    <configsections>
    </configsections>
    <connectionstrings>
        <add name="WindowsApplication2.My.MySettings.ConnectionString">
            connectionString="Data Source=ARULJUSTIN\SQLEXPRESS;Initial Catalog=firemaintain;Integrated Security=True;Pooling=False"
            providerName="System.Data.SqlClient" />
    </add></connectionstrings>
    <startup>
        <supportedruntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />
    </startup>
</configuration>
Posted
Updated 26-Nov-13 20:09pm
v2
Comments
We need to see the code where you are connecting to Database.
Justin Arokiaraj 27-Nov-13 2:42am    
Private Sub Addpump_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim conn As New SqlConnection
Dim ada1 As New SqlDataAdapter()
Dim ds1 As New DataSet
Conn = New SqlConnection("Persist Security Info=false;User Id=justin;Data Source=ARULJUSTIN\SQLEXPRESS;Initial Catalog=firemaintain;Integrated Security=True;Pooling=False")
Conn.Open()
ada1 = New SqlDataAdapter("select Pumpno,Pumplocation,Pumptype,recordactive from pumpRooms", Conn)
ada1.Fill(ds1)
DataGridView1.DataSource = ds1.Tables(0)
End Sub
On which line it is throwing the Exception.
You have ConnectionString declared in web.config, but you are not using it in code.

1 solution

In my opinion, the connection string is wrong. To set it properly, please see: connectionstring for ms sql server 2008/[^]

For further information, please see:
How to: Read Connection Strings from the Web.config File[^]
Connection Strings and Configuration Files[^]
 
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