none
compact and repair with jet engine RRS feed

  • Question

  • I added Microsoft Jet and Replication Objects 2.6 Library to references, and ialso added this line to my code:

    Dim jr As New JetEngine 

    This code is written in ChangeAndIndex() procedure.

    We compiled my code with x86 platform,but when i run it, my application encountered an error on ChangeAndIndex() Calling, (Please see the image)

    Please guide me where the problem is

    error:

    System.BadImageFormatException
      HResult=0x8013101B
      Message=Could not load file or assembly 'Interop.JRO, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
      Source=<Cannot evaluate the exception source>
      StackTrace:
    <Cannot evaluate the exception stack trace>

    • Edited by Ashkan209 Tuesday, February 13, 2018 9:20 AM
    Tuesday, February 13, 2018 7:43 AM

Answers

  • I added this line to the app.config and the problem was fixed

    <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>

    • Marked as answer by Ashkan209 Sunday, February 25, 2018 10:20 AM
    Sunday, February 25, 2018 10:20 AM

All replies

  • Tuesday, February 13, 2018 9:22 AM
  • It looks like you are trying to run something that is a 64 bit  assembly on a 32bit machine, because that's what the exception message you are getting means about bad imageformat.
    Tuesday, February 13, 2018 11:14 AM
  • Don't use JRO unless you are working with an .mdb file (Access 2003 or earlier). This library does not support the .accdb (Access 2007 and later) format.

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Tuesday, February 13, 2018 12:48 PM
  • My database is mdb format
    Tuesday, February 13, 2018 5:48 PM
  • My database is mdb format

    In that case, remove Microsoft Jet and Replication Objects (JRO) from the References of your project, delete the JRO.Interop.dll file from the bin folder and then go back and add Microsoft Jet and Replication Objects back to the project.

    This should cause the JRO.Interop.dll file to be recreated.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Tuesday, February 13, 2018 5:56 PM
  • Hi Ashkan209,

    According to your error " HResult=0x8013101B ", please open app.config to see what version of your project to run. It means that your supported runtime to be 2.6.0.0 and successfully find it. Now, it is confused because it sees that the assembly is built with a higher version. Instead of silently accepting this fact, it forces you to look into this as an issue. This is my understanding.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 14, 2018 2:59 AM
    Moderator
  • I do this, but the problem is still there
    Wednesday, February 14, 2018 6:05 AM
  • this is app.config, Please tell me which line is your order

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <appSettings>
        <add key="CheckUpdateAddress1" value="ch1" />
        <add key="CheckUpdateAddress2" value="ch2" />
        <add key="SiteBimehNet" value="ch3" />
        <add key="ClientSettingsProvider.ServiceUri" value="" />
      </appSettings>
      <system.diagnostics>
        <sources>
          <!-- This section defines the logging configuration for My.Application.Log -->
          <source name="DefaultSource" switchName="DefaultSwitch">
            <listeners>
              <add name="FileLog" />
              <!-- Uncomment the below section to write to the Application Event Log -->
              <!--<add name="EventLog"/>-->
            </listeners>
          </source>
        </sources>
        <switches>
          <add name="DefaultSwitch" value="Information" />
        </switches>
        <sharedListeners>
          <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" />
          <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
          <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
        </sharedListeners>
      </system.diagnostics>
      <system.web>
        <membership defaultProvider="ClientAuthenticationMembershipProvider">
          <providers>
            <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
          </providers>
        </membership>
        <roleManager defaultProvider="ClientRoleProvider" enabled="true">
          <providers>
            <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
          </providers>
        </roleManager>
      </system.web>
    </configuration>

    Wednesday, February 14, 2018 7:11 AM
  • I replaced the file in the application folder with the older one (older version of my application), and set copy local to false,the problem was fixed, why?



    • Edited by Ashkan209 Wednesday, February 14, 2018 7:25 AM
    Wednesday, February 14, 2018 7:15 AM
  • I do this, but the problem is still there

    What version of the .NET Framework is your app targeting (configured for)? I'm not sure which version of Visual Studio you are working with but it sounds like your app is building with an older version of the .NET Framework.

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, February 14, 2018 3:48 PM
  • .NET Framework 2.0
    Wednesday, February 21, 2018 4:14 AM
  • .NET Framework 2.0

    Can you update to a newer version? This version is no longer supported.

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, February 21, 2018 1:29 PM
  • I changed the destination framework to 3.5 version, then I did the following in order:

    1-Restart visual studio

    2- Run the clean project

    3- Clear the contents of the bin folder

    4- Change copy local of jro reference to true

    5- Rebuild the project

    But it continues to display the same error

    System.BadImageFormatException
      HResult=0x8013101B
      Message=Could not load file or assembly 'Interop.JRO, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
      Source=<Cannot evaluate the exception source>
      StackTrace:
    <Cannot evaluate the exception stack trace>




    • Edited by Ashkan209 Sunday, February 25, 2018 5:23 AM
    Sunday, February 25, 2018 5:21 AM
  • I added this line to the app.config and the problem was fixed

    <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>

    • Marked as answer by Ashkan209 Sunday, February 25, 2018 10:20 AM
    Sunday, February 25, 2018 10:20 AM