making a connection string to localDB

  • Thread starter Thread starter Gidmaestro
  • Start date Start date
G

Gidmaestro

Guest
I have a VB.net application that interacts with a SQL Server database on my local PC. I want to distribute it, so I tried to get it to work with LocalDB.

In my app.config file I put the following, but the connection times out.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<connectionStrings>
<add name="MyConnectionString"
connectionString="Data Source=(LocalDb)\MSSQLLocalDB;Initial Catalog=EchoDatabase;Integrated Security=SSPI;AttachDBFilename=App_Data\EchoDatabase.mdf"
providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>

My visual studio project looks like this:

1452502.png

Any help is appreciated - oh, I should add one more piece of code:

Public Shared ReadOnly Property ConnectionString As String
Get
Return ConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionString
End Get
End Property

Thanks.

Continue reading...
 
Back
Top