Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27381

Database not foudn after publishing

$
0
0
Hi all,

i am creating an application in VS 2010 (VB) that uses a local Compact SQL (.sdf) database.

I have configured my connection as per below and it works perfectly in the F5/Run command of teh VS 2010 environment.

Code:

Dim strConn As String = "Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5; Data Source = MyDatabase.sdf"
When I publish the application, it returns that teh database could not be found...

I have put a "build action" for the database file as: "Content"

How do I change my connection string to reflect the correct path of the database file?

I added it in my Resources tab as a file in my project's properties but then the code refuses a change to:

Code:

Dim strConn As String = "Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5; Data Source = " & My.Resources.MyDatabase & """"
because "the operator & is not defined for string and 1-dimensial-binary"

Viewing all articles
Browse latest Browse all 27381

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>