c# 4.0 - Open SQL Server CE database data from read only file system -
i use sql server ce database application. program located on dvd.
i cannot read data database on dvd, set sql connection string mode read doesn't work (i want read data db)
error:
opening database read-only requires temp path specified. [ db name = c:\users\ali\appdata\local\temp\rar$ex52.280... ]
please help!
in order open sql server ce database file (sdf) on read-only media, need add 2 additional parameters connection string
- mode=read only
- temp path=[path]
you follows:
connectionstring = string.format(@"data source = {0}\{1};mode = read only;temp path={2}", databasedirectory, databasename, system.io.path.gettemppath());
if getting connection string app.config
see https://stackoverflow.com/a/10731515/19624
string connectionstring = configurationmanager.connectionstrings["myconnectionstring"].connectionstring; connectionstring += ";mode = read only;temp path=" + system.io.path.gettemppath());
Comments
Post a Comment