Jump to content

OlmanQuesada

Mobilize.Net Staff
  • Content count

    28
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by OlmanQuesada

  1. Oracle Data provider (ODP.Net) in a migrated project 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" oConn.Open 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 oConn.Open(); 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; oConn.Open(); Basically, these are the only changes in your code to establish an Oracle DataBase connection using ODP.NET. happy migration!
  2. OlmanQuesada

    MSDATASRC... doesn't work in code!

    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. Regards, OlmanQ
  3. OlmanQuesada

    No project converts

    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 https://www.mobilize.net/support/documentation/VBUC-system-requirements Please, verify the vb6 code in your machine compiles and them try converting that code. OlmanQ
  4. OlmanQuesada

    Control array not upgraded

    Hi Good to hear that. OlmanQ
  5. OlmanQuesada

    Control array not upgraded

    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. Thanks, OlmanQ
  6. OlmanQuesada

    No project converts

    Hi, The vb6 application you're converting compiles in the machine where the VBUC is installed? OlmanQ
  7. OlmanQuesada

    VB6 to 2017 C# Migration

    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. Regards, OlmanQ
  8. OlmanQuesada

    Migration issue from VB 6 to VB.NET 2017

    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. OlmanQ
  9. OlmanQuesada

    Upgrade hangs

    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 oquesada@mobilize.net Regards, OlmanQ If so, it is possible for you to send me the project being migrated?
  10. OlmanQuesada

    Upgrade hangs

    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. Regards, OlmanQ
  11. OlmanQuesada

    .dvb to vb.net

    Hi Shreenivas, The VBUC tool does not support dvb files as this is a proprietary AUTOCAD format so it's out of our control. Regards, OlmanQ
  12. OlmanQuesada

    .dvb to vb.net

    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.
  13. OlmanQuesada

    COM or no COM

    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. OlmanQ
  14. OlmanQuesada

    MultiDimensional Array with ArraysHelper

    Thanks Kevin, I'm glad to hear the issue is gone. As you mentioned, by just modifying the property return type would fix the issue. Cheers, OlmanQ
  15. OlmanQuesada

    MultiDimensional Array with ArraysHelper

    Thanks Kevin, Could you please include the definition of mobjEmployeeL2.EmployeeArray in both languages VB6 and C#, and the definition of astrGridData in vb6? OlmanQ
  16. OlmanQuesada

    MultiDimensional Array with ArraysHelper

    Hi Kevin, Could you send us a code sample where this error is happening? Please includes all variables definitions. Regards, OlmanQ
  17. OlmanQuesada

    rs.Properties("Unique Table")

    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>]; rs.Tables["table1"].Rows.Remove(rowDel); rs.Delete() Cheers, OlmanQ
  18. OlmanQuesada

    rs.Properties("Unique Table")

    Hi Michael, Could be that possible to give us more context about the code. Perhaps a small VB6 sample code. Regards Olman Q
  19. OlmanQuesada

    license fingerprint

    Hi Marco, Let's continue with this support via email. I'll contact you at the email indicated in your profile. Olman Q
  20. OlmanQuesada

    license fingerprint

    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. Regards Olman Q
  21. OlmanQuesada

    license fingerprint

    Hi Marco, Could you please indicate me on behalf of whom is the license. I'm asking this in order to generate a new license with the exact information. Regards
  22. OlmanQuesada

    VBU.exe has encountered a problem and needs to close...

    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). Regards, Olman Q
  23. OlmanQuesada

    license fingerprint

    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. Regards
  24. OlmanQuesada

    license fingerprint

    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. Regards, Olman Q
  25. OlmanQuesada

    license fingerprint

    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. Cheers OlmanQ
×