开发者

iBatis.Net SQL Server Compact Edition 3.5

I want to migrate one of our databasis from SQL Server Express to SQL Server Compact 3.5. I'm using iBatis.Net but do not know what the providers.config must look like 开发者_如何学编程for me to be able to access SQL CE 3.5.

Can anyone help me out with this?

Thanks Johan


Well I spent a day or so working on this for a pet project. I was able to get this working with Sql Server Compact 3.5 and iBatis.Net 1.6.2 on .Net Framework 4.0. If you wanted it to run on a different version you'll need to update the Version and PublicKeyToken of the parameterDbTypeClass attribute.

You just need to add the following to your provider.config file.

  <provider
      name="sqlServerCompact3.5"
       enabled="true"
       description="Microsoft SQL Server Compact 3.5, provider V3.5.1.0 in framework .NET V2.0"
       assemblyName="System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
       connectionClass="System.Data.SqlServerCe.SqlCeConnection"
       commandClass="System.Data.SqlServerCe.SqlCeCommand"
       parameterClass="System.Data.SqlServerCe.SqlCeParameter"
       parameterDbTypeClass="System.Data.SqlDbType, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
       parameterDbTypeProperty="SqlDbType"
       dataAdapterClass="System.Data.SqlServerCe.SqlCeDataAdapter"
       commandBuilderClass=" System.Data.SqlServerCe.SqlCeCommandBuilder"
       usePositionalParameters = "false"
       useParameterPrefixInSql = "true"
       useParameterPrefixInParameter = "true"
       parameterPrefix="@"
       allowMARS="false"
  />


For what it's worth, here's what I have for SQL CE 4.0 (mostly pulled from the previous answer, just updated with version):

<provider
    name="sqlServerCompact4.0"
     enabled="true"
     description="Microsoft SQL Server Compact 4.0, provider V4.0.0.0 in framework .NET V2.0"
     assemblyName="System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
     connectionClass="System.Data.SqlServerCe.SqlCeConnection"
     commandClass="System.Data.SqlServerCe.SqlCeCommand"
     parameterClass="System.Data.SqlServerCe.SqlCeParameter"
     parameterDbTypeClass="System.Data.SqlDbType, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
     parameterDbTypeProperty="SqlDbType"
     dataAdapterClass="System.Data.SqlServerCe.SqlCeDataAdapter"
     commandBuilderClass=" System.Data.SqlServerCe.SqlCeCommandBuilder"
     usePositionalParameters = "false"
     useParameterPrefixInSql = "true"
     useParameterPrefixInParameter = "true"
     parameterPrefix="@"
     allowMARS="false"
/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜