PC Review


Reply
Thread Tools Rate Thread

SqlServer CE connection string

 
 
Elvandar
Guest
Posts: n/a
 
      23rd Oct 2009
Hi all!!

I'm developing an application using VS2005 to deploy on a WM6
device...the application uses a small SqlServer CE database.

The problem is during the connection to this database: I used the
"wizard" in VS2005 to create the database and the DataSet. Then I added
a Table Adapter to create some queries, but I noticed that in the
DataSet.xsd file it puts this connection string:

<Connections>
<Connection ConnectionStringObject="Data Source
=&quot;.\MyDB.sdf&quot;" IsAppSettingsProperty="False"
Modifier="Assembly" Name="MyAppConnectionString" ParameterPrefix="@"
Provider="Microsoft.SqlServerCe.Client">
</Connection>

where the Data Source has its path and filename. The problem is that the
only way to make my app find the database is to put the absolute path to
the .sdf file ("\Program Files\MyApp\MyDB.sdf"). In all other cases it
fails...

I should put a relative path to the .sdf file because my app can be
installed both on English and Italian devices, where the Program Files
folder is named "Programmi". I already tried to put
%CSIDL_PROGRAM_FILES%\MyApp\MyDB.sdf as path, but it doesn't work...

Do you have any solution to this problem? I'd like to mantain this
structure created with the wizard, without have to create my
SqlCeConnection objects, etc...

Thanks to all for any answer!




--
"Grazie, re, per aver accettato di lasciarti vincere soltanto dai tuoi
soldati"
Veterano di fanteria ad Alessandro Magno, rive del fiume Ifasi, 326 a.C.
 
Reply With Quote
 
 
 
 
Rüdiger Kardel
Guest
Posts: n/a
 
      23rd Oct 2009
Am Fri, 23 Oct 2009 14:57:53 +0200 schrieb Elvandar:

> I should put a relative path to the .sdf file because my app can be
> installed both on English and Italian devices, where the Program Files
> folder is named "Programmi". I already tried to put
> %CSIDL_PROGRAM_FILES%\MyApp\MyDB.sdf as path, but it doesn't work...
>


System.Environment.GetFolderPath(Environment.SpecialFolder.Programs)
should provide you with the required folder name.

regards
Ruediger
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Upgrading ASP w/SQLserver 2000 to ASP.NET w/ SQLserver 2005 =?Utf-8?B?SmVmZnJleQ==?= Microsoft ASP .NET 2 27th Apr 2007 04:33 PM
access 2003 join on two sqlserver 2000 tables (one table is from a linked navision 3.70 server on sqlserver 2000) Hubert Mayr Microsoft Access 1 4th Jan 2006 02:22 AM
How do I setup the SqlServer / IIS to sync with my SqlServer CE =?Utf-8?B?RGFu?= Microsoft Dot NET Compact Framework 1 11th Feb 2005 03:41 PM
Using SQLServer Session State without connection string in web.config Chris Snyder Microsoft ASP .NET 1 23rd Aug 2004 01:53 PM
Accessing SqlServer from a machine without SqlServer =?Utf-8?B?anl0Y2hhbmc=?= Microsoft Dot NET 1 5th Feb 2004 07:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:55 PM.