Jump to content


Mobilize.Net Staff
  • Posts

  • Joined

  • Last visited

  • Days Won


Posts posted by OlmanQuesada

  1. Old Visual Basic 6 applications interacting with Oracle databases may rely on the MSDAORA driver in the connection string to establish such communication when that code is converted to .NET, the Visual Basic Upgrade Companion (VBUC) will keep the same connection string and therefore be use the old MSDAORA driver. But, in .NET we can take advantage of the Oracle Data Provider (ODP.Net) technology developed by Oracle instead.

    The following VB6 code shows a database connection though the MSDAORA provider:

    Dim oConn As ADODB.Connection

    Set oConn = New ADODB.Connection

    oConn.ConnectionString = "Provider=MSDAORA.1;Password=" & sPassword & ";User ID = " & sUser & "; Data Source= " & sServer & ";Locales Identifier=1033"



    When this code is converted to .NET using the VBUC the code look like this:

    DbConnection oConn = UpgradeHelpers.DB.AdoFactoryManager.GetFactory().CreateConnection();

    oConn.ConnectionString = "Provider=MSDAORA.1;Password=" + sPassword + ";User ID = " + sUser + "; Data Source= " + sServer + ";Locales Identifier=1033";

    //UPGRADE_TODO: (7010) The connection string must be verified to fullfill the .NET data provider connection string requirements. More Information: https://www.mobilize.net/vbtonet/ewis/ewi7010


    Note: ADODB component is migrated to ADO.NET using System.Data.Common and helper classes.


    As you can see the migrated application is still using the MSDAORA provider.

    If your final goal is taking full advantage of the .NET technology, you may want to replace that provider for the ODP.Net developed by Oracle. In this case, you need to go to the Oracle Data Provider .NET download page (http://www.oracle.com/technetwork/topics/dotnet/index-085163.html) and choose the required version of this .NET component.

    After installing and configuring the ODP.NET component on your machine you will have to make some minor adjustments to the migrated code:

    1. Add the Oracle.DataAccess.Client factory

    Mobilize helper classes use a DVProviderFactory to create the right ADO.NET object according to the database connection provider in use:

    • OleDb providers will use the System.Data.OleDb namespace. This is valid for MS-Access files and any OleDb provider like the MSDAORA one.
    • ODBC providers will use the System.Data.ODBC namespace
    • SqlServer can use the System.Data.SqlClient namespace
    • Oracle providers for .NET will use Oracle.DataAccess.Client namespace that comes with the ODP.NET installer. If this assembly is not installed an exception will raise at runtime.


    To use the Oracle.DataAccess.Client, find the method Load DefaultFactorySettings that comes in the AdoFactoryManager class from the UpgradeHelpers.DB.Essentials helper project and uncomment-out the line:

    factorySection.Add("Oracle", new FactoryConfigurationElement("Oracle", "Oracle.DataAccess.Client", DatabaseType.Oracle, false));

    and comment-out this line:

    factorySection.Add("Oracle", new FactoryConfigurationElement("Oracle", "Oracle.DataAccess.Client", DatabaseType.Oracle, false));

     So, this method should looks like this:

             private static void LoadDefaultFactorySettings(Dictionary<string, FactoryConfigurationElement> factorySection)


                factorySection.Add("Access", new FactoryConfigurationElement("Access", "System.Data.OleDb", DatabaseType.Access, true));

                factorySection.Add("SQLServer", new FactoryConfigurationElement("SQLServer", "System.Data.SqlClient", DatabaseType.SQLServer, false));

                //New Changes

                factorySection.Add("Oracle", new FactoryConfigurationElement("Oracle", "Oracle.DataAccess.Client", DatabaseType.Oracle, false));

                //factorySection.Add("Oracle", new FactoryConfigurationElement("Oracle", "System.Data.OracleClient", DatabaseType.Oracle, false));

                factorySection.Add("ODBC", new FactoryConfigurationElement("ODBC", "System.Data.Odbc", DatabaseType.Access, false));



    With these changes, any ADO.NET object (DBCommands, DBConnections, etc) created using the UpgradeHelpers.DB.AdoFactoryManager.GetFactory() will be instantiated using the types defined in Oracle.DataAccess.Client namespace.


    2. Correct the Connection String

    As illustrated in the VB6 code above, the connection string is using an OLEDb provider (MSDAORA), so we need to change that string to send the parameters required by the ODP.NET provider:


    string conStr = "Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST="+ sServer + ")(PORT="+ sPort + ")))(CONNECT_DATA=(SID="+ sSID + ")(SERVER=shared)))";

    conStr = conStr + ";" + "User Id=" + sUser + ";Password=" + sPassword;

    DbConnection oConn = UpgradeHelpers.DB.AdoFactoryManager.GetFactory().CreateConnection();

    oConn.ConnectionString = conStr;



    Basically, these are the only changes in your code to establish an Oracle DataBase connection using ODP.NET.


    happy migration!

    • Like 1
  2. Hi Devon,

    the cbo is a Activex Combobox, so it's not a .Net control. Because of that, the RowSource property cannot be assigned to a .Net class. At this point there are two alternatives:

    1. Change the AxDataCombo by a .Net control. In that case it would be compatible with other .Net classes/components. This have to be done in a manual fashion as currently the VBUC does not automatically convert that control to a .Net one.

    2. Migrate the vb6 code using ADODB via Com Interop (see attached file). By doing this, all classic adodb code willnot be converted to ADO.Net, so the cbo.RowSource and the rst object may be compatible.

    However, as you're converting your code to .Net my suggestion would be the option 1.







  3. Hi,

    Sorry for the misunderstanding.

    The VBUC requires all the references to all third party components as well as any library that is part of the VB6 project . The best way to validate that is compiling the vb6 code in the same machine where the VBUC tool is installed.

    You can get more information about how to prepare the code to be migrated by visiting our VBUC System Requirements page


    Please, verify the vb6 code in your machine compiles and them try converting that code.



  4. Hi FGallagher,

    Is that possible to provide more info about the issue you are having?

    If would be helpful to get the following:

    1. log file of the migration. You can get the log file by going to the Upgrade tab at the top of the VBUC and click on "Open Upgrade Log" button.

    2. Screenshot of the error.






  5. Hi Ramya,

    Code migrated not necessarily compiles without requiring manual changes and having installed in the machine where the VS.Net code is located all thirdy party components required by the vb6application and are used via COM interop by the .Net migrated code.

    After migrating the vb6 code you may need to address the following issues in order to have the code compiling:

    1. Make sure all dll's (COM and Assembly ones) and thirdy party components used by the vb6 application and used via COM Interop by the migrated code are installed on the development machine where Vs.Net code is located. If dll's required by the migrated code are not in the .Net development environment, then, missing references errors are thown by Vs.Net.

    2. EWIs review:

    In the generated code you may find some messages inserted by the Upgrade tool that provide some useful information about code patterns/methods/events that have not a direct equivalent in .Net and require your attention:

    a.UPGRADE_TODO: (1065) Error handling statement (Resume Next | On Error Goto) could not be converted. 

    b.UPGRADE_TODO: (1067) Member <member> is not defined in type <type> 

    c.UPGRADE_ISSUE: (2064) <Object> (method | property | event) <member> was not upgraded 

    d.UPGRADE_WARNING: (206) Untranslated statement in <method> 

    e.UPGRADE_ERROR: (1010) The preceding line couldn't be parsed 

    3. If the converted application connects to a Database, some adjustments in the connection string may be needed.


    Please le tme know if this resolve your question.





  6. Hi Devashi,

    I looks like your vb6 application is using that component/reference that is used in the migrated application as well via COM Interop. Before migrating a vb6 application, make sure the source code to be migrated compiles, that would help you to know if there are missing components/references. Some of those components can be converted to .Net equivalents but some others don't so they would be used via COM Interop.

    All those components that would be used via COM Interop by the migrated code will need to be properly installed in the machine where the .Net code is executed.

    Please let me know if that answers your question.


  7. Hi Nas,

    The vb6 code is compiling on the machine where it's being migrated? I think I 'll need more info about the issue. Is it possible for you to send me the project being migrated. My email is [email protected]






    If so, it is possible for you to send me the project being migrated?

    • Like 1
  8. Hi Nas,


    I'd like to ask you a couple of things:

    1. Version of VBUC. You can get this info in the about windows.

    2. Upgrade Log file. You can get it by going to the Upgrade section, then choose Open Upgrade Log.








  9. Hi,


    Could you please send me a vb6 sample including that file? I tried creating a vb6 project from scratch, then adding the attached dvb file, but VB6 is not able to add that file to a valid vb6 project.

  10. Hi,

    The Visual Basic Upgrade Tool (VBUC for short) support the conversion of some COM/Activex components to .Net equivalents, however, it's possible some properties or methods may not be supported in .Net.

    At the end of the day an Activex is not a .Net component and given that VS.Net creates an interop wrapper to communicate the .Net Framework with the COM component in practice, some functionality of the Activex could cause memory-leaks. It is also possible some component design properties are not accessible in .Net.

    In regards with your second question, for a COM / Activex component to work in .Net, the in application must be compiled in 32 bits. If you want to have a 64bits app, yuou need to replace all COM functionality by .Net.

    Please let me know if you have any other question.


  11. Hi Michael,

    ADO.Net does not provide a direct way to achieve that, so the migrated code should be modified to get a similar result.
    As the ADORecordsetHelper inherits from a Dataset, the properties of that class could be used:

    Given rs is a ADORecordsetHelper you can try the following:
    DataRow rowDel=ds.Tables["table1"].Rows[<IndexOfTheRowToDelete>];



  12. Hi Marco,


    Thanks for the info. Our License department is asking for the license info. This cab be got from the VBUC in the menu Tools->License Info. If you can send me a screenshot that would help to track the info for that license.




    Olman Q

  13. Hi Jamie,

    Sorry for the delay.

    The Helpers are written in C#, so when the code is migrated to VB.Net, the VBUC switches the "Helper Integration" option to binary, but you can change it back to "Source Code".

    We've found the error is not present when the code is converted to a newer version of VS.Net (like 2013/2015).




    Olman Q

  14. Hi Marco,


    I think the VBUC.Lic file may be corrupted. I'm resending to you a trial versions license to migrate up to 10K lines of code, please check your email.

    Please, re-install the VBUC and use the attached Trial_VBUC.Lic to activate the trial version.



  15. Hi Marco,

    I need some additional info in order to reproduce the issue. Could you please indicate which OS are you running on? Any other useful information about how you get this error would be helpful.

    Another option. You can try installing and running the VBUC (using admin rights) in a fresh machine.



    Olman Q

  16. Hi Marco,

    Please make sure to run the Visual basic Upgrade Companion (VBUC) using admin rights.

    Can you provide us with the version number of the Visual Basic Upgrade Companion (VBUC)? You can get this by opening the VBUC and then click on the upper left arrow and select the About option.





  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use