Connecting Tech Pros Worldwide Help | Site Map

need help with SqlCeConnection and app.config

Sl1ver's Avatar
Member
 
Join Date: Mar 2009
Location: Cape Town, South Africa
Posts: 102
#1: Mar 19 '09
i can't get the mobile app to make a connection from the app.exe.config but if i hard code the DB path it connects. ConfigurationManagerCE is a seperate class
Expand|Select|Wrap|Line Numbers
  1. app.config.exe
  2. <?xml version="1.0" encoding="utf-8"?>
  3. <configuration>
  4.   <appSettings>
  5.     <add key="MobileDBPath" value="\Program Files\Mobile\qxAsset.sdf" />
  6.     <add key="WebService" value="http://JM-QwixWHv2/asset/SyncService.asmx" />
  7.     <add key="CSVPaths" value="\Program Files\Mobile" />
  8.   </appSettings>
  9. </configuration>
  10.  
and here is the connection coding
Expand|Select|Wrap|Line Numbers
  1. SqlCeConnection myConn = new SqlCeConnection();
  2.             string strConn = ConfigurationManagerCE.AppSettings["MobileDBPath"].ToString();
  3.             myConn.ConnectionString = strConn;
  4.             myConn.Open();
  5.  
whats wrong with connection coding?
Reply