Can't connect to database file ( mdf )
-
I wrote simple winform ( part of it with WPF ). In the simple application i have some place that i get information from database ( from mdf file ). The code ..
public SomeDBObject : System.Data.Linq.DataContext { ... some code ... } List< SomeDBObject > listViewItem = null; try { listViewItem = new List< SomeDBObject >(); using( DBDataContext dBDataContext = new DBDataContext( mdf_File_Path_String ) ) { listViewItem.AddRange( from item in dBDataContext.dBs select ( SomeDBObject ) item ); } } catch( Exception e ) { ... }
now, on my machine and on some other machine all work fine. But some on some other machine that i install ( clean machine ) my application i get exception from the line using( DBDataContext dBDataContext = new DBDataContext( mdfFilePathString ) ) and the exception is about some problem with the sql on the machine. The exception: a database with the same name exists, or specified file cannot be opened, or it is located on unc share. This is happaning with win7 and win Xp also. I try to re-install the sql 2008 express - but this is not halping.