Locked MIgration From Office 2003 to 2007

  • Thursday, February 16, 2012 1:39 PM
     
      Has Code

    HI

    I have a application VB.net which is working fine for office 2003.But one of the user has installed office 2007.

    I dont have the knowledge of BindingRedirect .

    Old references

    Interop.Access version 11.0

    VBE.Interop version 11.0

    here is the configuarion changes, i have done.

     <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Office.Interop.Access"
                              publicKeyToken="71E9BCE111E9429C"
                              culture="neutral" />
            <bindingRedirect oldVersion="11.0.0.0"
                             newVersion="12.0.0.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Vbe.Interop"
                              publicKeyToken="71E9BCE111E9429C"
                              culture="neutral" />
            <bindingRedirect oldVersion="11.0.0.0"
                             newVersion="12.0.0.0"/>
          </dependentAssembly>
        </assemblyBinding>
    
      </runtime>

    Thanks in advance

All Replies

  • Monday, February 20, 2012 6:30 AM
    Moderator
     
     

    Hi Sudheer,

    Welcome to the MSDN Forum.

    Here is an article about BindingRedirect: http://msdn.microsoft.com/en-us/library/eftw1fys.aspx 

    Now, what is the issue? Do you just want to know what is BindingRedirect or you have encountered some problem with this attribute?

    If you got some issues, please tell us more about your issue.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Thursday, February 23, 2012 9:55 AM
     
     

    HI Mike,

    I need to change the config so that the app can able to work on the pc which has office 2003 as well as office 2007.

    I am not sure whether the above change will make it correct or not.

    and

    if you see the above references " interop.access , vbe.interop"

    whether both references needs to be mentioned in config or One will be enough,since public key is same for them.

  • Friday, February 24, 2012 3:49 AM
    Moderator
     
     

    HI Mike,

    I need to change the config so that the app can able to work on the pc which has office 2003 as well as office 2007.

    I am not sure whether the above change will make it correct or not.

    and

    if you see the above references " interop.access , vbe.interop"

    whether both references needs to be mentioned in config or One will be enough,since public key is same for them.

    Hi Sudheer,

    >>I am not sure whether the above change will make it correct or not.

    How about your application run on only office 2003 or 2007? Does it work fine? If so, your way is correct, if not, please post the error message and other related information here, the other community members and I will try our best to help you out.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Friday, February 24, 2012 1:56 PM
     
     

    HI Mike,

    I will mention the details soon.

    But , please clarify the doubt.

    If  i want my application to run in win7 with office 2010.

    what and where  do i have to change the configurations?

    thanks in advance

  • Monday, February 27, 2012 2:14 AM
    Moderator
     
     

    HI Mike,

    I will mention the details soon.

    But , please clarify the doubt.

    If  i want my application to run in win7 with office 2010.

    what and where  do i have to change the configurations?

    thanks in advance

    Hi Sudheer,

    Please try to change 12.0.0.0 to 14.0.0.0, office 2010 can also take care office 2007 well.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


  • Tuesday, February 28, 2012 2:40 PM
     
     

    Hi Mike,

    Hope you are doing good.

    I tried but failed.

    I run the application in different env

    winxp:2003 (exe or code)

    Worked fine if i interchange old and new version

    win7:Office 2007 (exe)

    Unable to find office.interop.acces.dll.12(Checked assembly but didnt find it) 

    win7:office2010 (exe or code)

    Unable to find office.interop.acces.dll.14(Checked assembly but didnt find it) even after installing .net pia Redistributable.

    Best Regards,

    Sudheer

  • Wednesday, February 29, 2012 6:05 AM
    Moderator
     
     

    Hi Sudheer,

    Generally, you can find the office assembly after you installed office. So now, I suggest you try to repair your VS or re-install office to fix this error.

    In addition, this blog may be helpful: http://blogs.msdn.com/b/andreww/archive/2007/06/08/why-is-vs-development-not-supported-with-multiple-versions-of-office.aspx 

    Why is VS development not supported with multiple versions of Office? 

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Wednesday, February 29, 2012 9:14 AM
     
     

    HI.

    I tried the app on differnet desktop ,not single

    see the message here.

    WIN7-Office2010

    See the end of this message for details on invoking debugging
    Just-In-Time (JIT) debugging instead of this dialog box.

    Exception Text ************** **************
    System.Runtime.InteropServices.COMException (0x80004005): Can not open database''. Your application does not recognize this type of database or the file is corrupted.
       
    in ADODB.ConnectionClass.Open (String ConnectionString, String UserID, String Password, Int32 Options)
       
    in Kpi_Analyzer.FrmMain.Xcoding () in R: \ Test \ Collection_Data \ Pgm \ Stat \ V1.3.1 \ Kpi_Analyzer \ Form1.cs: line 266
       
    in Kpi_Analyzer.FrmMain.bt_run_Click (Object sender, EventArgs e) in R: \ Test \ Collection_Data \ Pgm \ Stat \ V1.3.1 \ Kpi_Analyzer \ Form1.cs: line 497
       
    in System.Windows.Forms.Control.OnClick (EventArgs e)
       
    in System.Windows.Forms.Button.OnClick (EventArgs e)
       
    in System.Windows.Forms.Button.OnMouseUp (MouseEventArgs mevent)
       
    in System.Windows.Forms.Control.WmMouseUp (Message & m, MouseButtons button, Int32 clicks)
       
    at System.Windows.Forms.Control.WndProc (Message & m)
       
    in System.Windows.Forms.ButtonBase.WndProc (Message & m)
       
    in System.Windows.Forms.Button.WndProc (Message & m)
       
    in System.Windows.Forms.Control.ControlNativeWindow.OnMessage (Message & m)
       
    in System.Windows.Forms.Control.ControlNativeWindow.WndProc (Message & m)
       
    at System.Windows.Forms.NativeWindow.Callback (IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


    Loaded Assemblies ************** **************
    mscorlib
        
    Assembly Version: 2.0.0.0
        
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        
    CodeBase: file :/ / / C :/ Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    ----------------------------------------
    mscorlib.resources
        
    Assembly Version: 2.0.0.0
        
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        
    CodeBase: file :/ / / C :/ Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    ----------------------------------------
    Kpi_Analyzer
        
    Assembly Version: 1.0.1.0
        
    Win32 Version: 1.0.1.0
        
    CodeBase: file :/ / / R :/ Test/Collection_Data/Pgm/Stat/V1.3.1/Kpi_Analyzer/bin/Debug/Kpi_Analyzer.exe
    ----------------------------------------
    Microsoft.VisualBasic
        
    Assembly Version: 8.0.0.0
        
    Win32 Version: 8.0.50727.4927 (NetFXspW7.050727-4900)
        
    Codebase:
    ----------------------------------------
    System
        
    Assembly Version: 2.0.0.0
        
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        
    CodeBase: file :/ / / C :/ Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    System.Windows.Forms
        
    Assembly Version: 2.0.0.0
        
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        
    Codebase:
    ----------------------------------------
    System.Drawing
        
    Assembly Version: 2.0.0.0
        
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        
    CodeBase: file :/ / / C :/ Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    System.Configuration
        
    Assembly Version: 2.0.0.0
        
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        
    Codebase:
    ----------------------------------------
    System.Xml
        
    Assembly Version: 2.0.0.0
        
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        
    CodeBase: file :/ / / C :/ Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
    ----------------------------------------
    System.Runtime.Remoting
        
    Assembly Version: 2.0.0.0
        
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        
    Codebase:
    ----------------------------------------
    ADODB
        
    Assembly Version: 7.0.3300.0
        
    Win32 Version: 7.10.6070
        
    CodeBase: file :/ / / C :/ Windows/assembly/GAC/ADODB/7.0.3300.0__b03f5f7f11d50a3a/ADODB.dll
    ----------------------------------------
    Interop.JRO
        
    Assembly Version: 2.6.0.0
        
    Win32 Version: 2.6.0.0
        
    CodeBase: file :/ / / R :/ Test/Collection_Data/Pgm/Stat/V1.3.1/Kpi_Analyzer/bin/Debug/Interop.JRO.DLL
    ----------------------------------------
    System.Data
        
    Assembly Version: 2.0.0.0
        
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        
    CodeBase: file :/ / / C :/ Windows/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
    ----------------------------------------
    Microsoft.Office.Interop.Access
        
    Assembly Version: 14.0.0.0
        
    Win32 Version: 14.0.4750.1000
        
    Codebase:
    ----------------------------------------
    System.Windows.Forms.resources
        
    Assembly Version: 2.0.0.0
        
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        
    Codebase:
    ----------------------------------------

    JIT Debugging ************** **************
    To enable debugging Just In Time (JIT), the configuration file is
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled

    For example:

    " Ff="<system.windows.forms jitDebugging="true" /> " title="<system.windows.forms jitDebugging="true" />"><system.windows.forms jitDebugging="true" />
    When JIT debugging is enabled, any unhandled exception
    be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.


    • Edited by sudheer594 Wednesday, February 29, 2012 12:38 PM
    •  
  • Wednesday, February 29, 2012 3:38 PM
     
     

    You're coding in VB or C#? Because the error is in line 266 in file Form1.cs. Did you write it? If yes, show us the line that is opening an ADODB Connection. However, this does not seem to be Office Interop related. It looks more as if you're trying to open a file in a new format with an older application version that can not read the format, yet. 

    EDIT: a different provider and connection string could solve the problem. But this is just guessing. First we need to see a few lines of code around line #266.


    Armin




  • Friday, March 02, 2012 2:22 PM
     
      Has Code

    HI Armin

    I tried to recreate the setup of application and fortunately it worked.

    The only change i can fugure out bw old and new version is INTEROP.ADODB.dll Vs2.7.00 and Vs6.0.0.0

    The new appication is working fine with office 2003,2003,2010.

    Could you please clarify the reason

    Rs.Open("SELECT EAN FROM TMPWEEK", Conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
            My.Application.DoEvents()
            If Not Rs.EOF Then
                Rs.Close()
                ToolStripStatusLabel1.Text = "Generate reference to analyze ..."
                Me.Refresh()
                Conn.Close()
                Call Access_IE(MyDirDb & "\DATA.MDB", "TMPWEEK Import/Export", "", "TMPWEEK", MyDirDb & "\beshref.txt", "EXPORT")
    'the error occured here Line 266 (Not with office2003)
                Conn.Open()

    .

  • Friday, March 02, 2012 2:54 PM
     
     Answered

    As written before, the database seems to be in a new file format the can not be read by the old ADODB version.

    BTW, It's also recommended not to use DoEvents.


    Armin

    • Marked As Answer by sudheer594 Monday, March 05, 2012 9:38 AM
    •  
  • Monday, March 05, 2012 9:39 AM
     
     
    Thank you for the assistance.