Search code examples
linqlinq-to-sqlsql-server-cesqlmetal

Problem with generate *DBML file from *SDF with SqlMetal util


I try generate dbml from sdf file.

So I localize sqlMetal util in: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin

Sdf DB file path: D:\DB_TEST\Spiri_SQL_CE_DB.sdf

So I try this command on generate dbml file:

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin>sqlmetal.exe D:\DB_TEST\
Spiri_SQL_CE_DB.sdf /dbml:D:\DB_TEST\Spiri_SQL_CE_DB.sdf\Spiri_SQL_CE_DB.dbml

I get this error:

Error : SQM1007: There is an IO error and the output file 'D:\DB_TEST\Spiri_SQL_
CE_DB.sdf\Spiri_SQL_CE_DB.dbml' cannot be opened.

So I try this command:

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin>sqlmetal.exe D:\DB_TEST\
Spiri_SQL_CE_DB.sdf /dbml:Spiri_SQL_CE_DB.dbml

But I get this error:

Error : Access to the path 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\
Bin\Spiri_SQL_CE_DB.dbml' is denied.

On the end I try this version of command:

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin>sqlMetal /dbml:Spiri_SQL
_CE_DB.dbml D:\DB_TEST\Spiri_SQL_CE_DB.sdf

But I get same error:

Error : Access to the path 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\
Bin\Spiri_SQL_CE_DB.dbml' is denied.

I know that file Spiri_SQL_CE_DB.dbml doesn’t exist yet, but I try generate with sqlMetal turil this file, what is bad?


Solution

  • Copy both the SDF and DBML to a location where you have sufficient write/modify rights.

    Else start the command prompt with elevated permissions (aka runas administrator).

    BTW your first attempt is completely bogus.

    OR do:

    sqlMetal /dbml:D:\DB_TEST\Spiri_SQL_CE_DB.dbml D:\DB_TEST\Spiri_SQL_CE_DB.sdf