c# - SQL Server CE Incompatible Database Version -
i have sql server ce 4.0 database (.sdf
file) , when trying doing query on database application (wpf) following error.
incompatible database version. if compatible file, run repair. other cases refer documentation. [ db version = 4000000,requested version = 3505053,file name = \?\c:\database\shortagereport\mrpdatabase.sdf]
- i have checked sql server ce 4 sp1 installed.
- i have tried creating database in both database.net 4 , in connection setup in vs2012.
- i'm running windows 7 64bit
- my connection string stored in
app.config
.
i using sql server compact toolbox generate context , mappings.
my app.config
:
<connectionstrings> <add name="databasecontext" providername="system.data.sqlserverce.4.0" connectionstring="data source=c:\database\shortagereport\mrpdatabase.sdf"/> </connectionstrings>
any ideas?
add reference version 4.0 system.data.sqlserverce.dll ado.net provider
then initialize datacontext
class sqlceconnection
(4.0) object.
using (sqlceconnection conn = new sqlceconnection(@"data source=c:\projects\chinook\chinook40.sdf")) { using (chinook db = new chinook(conn)) { var list = db.album.tolist(); if (list.count > 0) system.diagnostics.debug.print("it works!"); } }
Comments
Post a Comment