Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programmatic connection to SQL compact 4.0

Status
Not open for further replies.

5ilversaracen

Programmer
Nov 21, 2009
5
GB
hi guys
have installed Visual Web Developer 2010 Express along with SQL Compact 4.0 and I'm trying to programmatically connect to a database. Whatever I use as a connection string though seems to throw up errors primarily that the database doesnt exist.

The connection string I get from the Database Explorer is:

Data Source="C:\Documents and Settings\Amos\My Documents\Visual Studio 2010\Projects\MyFaceWebsite\MyFaceWebsite\MyFaceDB.sdf"

If i add a details view the connection in webconfig is:

<add name="ConnectionString" connectionString="Data Source=&quot;C:\Documents and Settings\Amos\My Documents\Visual Studio 2010\Projects\MyFaceWebsite\MyFaceWebsite\MyFaceDB.sdf&quot;"
providerName="System.Data.SqlServerCe.4.0" />

Does anyone know how to set this connection up programmatically?

Many thanks in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top