SQL Server Developer Center > SQL Server Forums > SQL Server Compact > Native Exception in GetKeyInfo()
Ask a questionAsk a question
 

AnswerNative Exception in GetKeyInfo()

  • Tuesday, November 25, 2008 7:28 PMCharlesJenkins Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    We developed a product on Win CE 5 using Visual Studio 2005. I am evaluating an upgrade to Visual Studio 2008 because we believe the SQL Server CE 3.5 database format is better supported.

    We installed updates in platform builder to get SQL Server CE 3.5 and we rebuilt the platform. I have installed Visual Studio 2008 with SP1 for both .net and SQL Server CE.

    I tried making an entirely new project with a fresh DB for testing, so that everything will agree and there won't be any strange faults lingering from settings in any old project. All the Properties sheets seems to indicate that my database is a 3.5 database. The project builds and deploys with no problems, but after the connection is open, any attempt to fill a table from the database results in this exception:

    Exception Code: 0x80000002
    Exception Address: 0x03194008
    Faulting Module: sqlceme35.dll
    at NativeMethods.GetKeyInfo( IntPtr pTx, String pwszBaseTable, IntPtr prgDbKeyInfo, Int32 cDbKeyInfo, IntPtr pError )
    at SqlCeDataReader.FillMetaData( SqlCeCommand command )
    at SqlCeCommand.InitializeDataReader( SqlCeDataReader reader, Int32 resultType )
    ...

    The fault is happening in MS code that I cannot step into...anyone recognize this problem?

Answers

  • Wednesday, November 26, 2008 5:29 AMDevesh Anand [MSFT]AnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi Charles,

     

    Could you please check that you are using the same version of native (sqlceme35.dll, sqlceqp35.dll etc)and managed dll (System.Data.SqlServerCe.dll). Please be aware that you are using Compact 3.5 RTM (File Version 5386 ) or Compact 3.5 SP1 (File Version  no 5692). 

     

    If there is not issue with the Compact version then please provide the sample Application and the call stack for the error.

     

    Please contact "Sql Server Compact Blog" from the following link http://blogs.msdn.com/sqlservercompact/contact.aspx

     

    You will able to send the repro application after any one from the SQL Compact team replies to your mail.

     

    Thanks & regards,

    Devesh Anand

  • Wednesday, November 26, 2008 5:35 AMVamshi Krishna MSFTAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    This error happens when there is mismatch in the version of SQLCE components being used.

     

    What is the exact version of SQLCE components being used on device/desktop?

    File version of all native components and managed components need to be same.

    Are you using 3.5 RTM (3.5.5386) or 3.5 SP1 (3.5.5692)?

     

    Ensure that all SQLCE assemblies loaded by your application are of same version.

    This should ideally resolve the issue.

     

    Hope this helps,

    Vamshi Krishna, SQL Compact, MSFT.

  • Wednesday, November 26, 2008 5:05 PMchrisb128 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    For me, the issue was caused by having the 3.5 SP1 components installed on the device, but then referencing the 3.5 RTM managed DLL in the assembly.  The trick was that the device had the SP1 native components installed but the SP1 managed components were not installed on my PC.  

    My resolution was to install the SP1 components on the desktop and re-reference them in my assemblies.

All Replies

  • Tuesday, November 25, 2008 9:05 PMchrisb128 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I'm having the same problem.
  • Wednesday, November 26, 2008 5:29 AMDevesh Anand [MSFT]AnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi Charles,

     

    Could you please check that you are using the same version of native (sqlceme35.dll, sqlceqp35.dll etc)and managed dll (System.Data.SqlServerCe.dll). Please be aware that you are using Compact 3.5 RTM (File Version 5386 ) or Compact 3.5 SP1 (File Version  no 5692). 

     

    If there is not issue with the Compact version then please provide the sample Application and the call stack for the error.

     

    Please contact "Sql Server Compact Blog" from the following link http://blogs.msdn.com/sqlservercompact/contact.aspx

     

    You will able to send the repro application after any one from the SQL Compact team replies to your mail.

     

    Thanks & regards,

    Devesh Anand

  • Wednesday, November 26, 2008 5:35 AMVamshi Krishna MSFTAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    This error happens when there is mismatch in the version of SQLCE components being used.

     

    What is the exact version of SQLCE components being used on device/desktop?

    File version of all native components and managed components need to be same.

    Are you using 3.5 RTM (3.5.5386) or 3.5 SP1 (3.5.5692)?

     

    Ensure that all SQLCE assemblies loaded by your application are of same version.

    This should ideally resolve the issue.

     

    Hope this helps,

    Vamshi Krishna, SQL Compact, MSFT.

  • Wednesday, November 26, 2008 5:05 PMchrisb128 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    For me, the issue was caused by having the 3.5 SP1 components installed on the device, but then referencing the 3.5 RTM managed DLL in the assembly.  The trick was that the device had the SP1 native components installed but the SP1 managed components were not installed on my PC.  

    My resolution was to install the SP1 components on the desktop and re-reference them in my assemblies.
  • Monday, December 01, 2008 6:11 PMCharlesJenkins Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank you all for your replies. I felt that there was a version mismatch SOMEWHERE, but just could not find it.

    Here is what I have done, and a followup question:

    Although the 3.5 SP 1 components are included in our platform, they do not seem to work. So I asked our guy with Platform Builder (PB) to make me a version with NO database support whatsoever, and I used the CAB files to install 3.5 SP1 myself after booting the device. That worked.

    If PB thinks it is installing the correct version of SQL CE but obviously is not, what can we do to fix it? Are the dll files themselves stored in a place we could get to them on our system running PB and upgrade them before building a platform?

    Thanks!