Jump to content

Search the Community

Showing results for tags 'vbuc'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General Discussion
    • Get Started
    • WebMap
    • VBUC
    • Silverlight Bridge
    • Blogs

Found 4 results

  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. Upgrade From TrueDBGrid 6.0 to TrueDBGrid 7.0

    Upgrade from TDBG 6 to TDBG 7 Summary The Visual Basic Upgrade Companion supports TrueDBGrid 7.0 and later versions, but not TrueDBGrid version 6.0. To migrate code containing version 6 controls, you must first upgrade TDBG 6.0 to TDBG 7.0 Problem Description TrueDBGrid 6.0 defines some properties of the grid in the frx file, while TrueDBGrid 7.0 defines them in the frm file. When a project in Visual Basic has a form, which contains a grid of type True DB Grid 6.0, some characteristics, such as properties of columns, positions, and more are defined in the form's frx file. Since the VBUC will only take the properties defined in the frm file, those properties embedded in the frx file are not migrated. So, to solve this issue, first migrate the version 6.0 controls to version 7.0 prior to migration with VBUC. How to Upgrade to Version 7 In your VB6 development machine, install TrueDBGrid 7.0 You can get an evaluation from this link: http://download.componentone.com/pub/truedbgridpro7/eval Copy to C:\Windows\System32 the next dll: tdbg8mu.dll You can get it from this link: http://gccontent.blob.core.windows.net/gccontent/blogs/legacy/c1/2011/07/tdbg8mu1_utility.zip Register that DLL using regsvr32 Modify the file C:\Windows\vbaddin.ini adding the next line: TDBG7MU.Connect=2 In Visual Basic 6, on the menu Add-Ins/Add-in select the option "Load on startup" for "TrueDBGrid 7.0 Migration Utility" Restart Visual Basic The following button will appear on the upper menu: Upgrade from TrueDBGrid 6.0 to TrueDBGrid 7.0 and from TrueDBGrid (OLEDB) 6.0 to TrueDBGrid (OLEDB) 7.0 (if applies) Open each form and press CTRL + S to save all changes Check that each form has changed, for example: Sometimes the changes won't be applied to the forms, if that happens some workaround will be needed: Add a grid (Version 7.0) on the form Save the form Delete the grid Save again Check changes were applied to the forms Post-migration to .NET After the migration to .NET, in C# some visual elements may need correcting. For example, This is how a grid should look after the migration using version 7 of TrueDBGrid: Because the designer file loaded incompletely, this is how the grid looks after the migration (column width incorrect): The following steps can fix these kinds of problems: Modify any property of the grid, like changing the position of an element or modifying the name of the grid. These changes should be done in the code of the designer file (designer.cs) Save and close all files Re-open the form: the grid should look correct If it's necessary, don't forget to undo all changes previously applied to the designer file. This workaround is needed because sometimes the designer isn't correctly rendered in the form, so when a new change is applied, it needs to load all the designer settings. Upgrade from TDBG 6.0 to TDBG 7.0.pdf
  3. MSDATASRC... doesn't work in code!

    This is converted code from a project. It is a basic combo box loading routine. The cbo.RowSource is an MSDATASRC an the rst is the created / converted ADORecordSetHelper. They aren't compatible! Okay so what can I assign in code to make this work?
  4. Analyzing your VB6 code

    Even if you don't have a license for the VBUC you can still use it to analyze your VB6 application. This analysis will provide you with some information about your project(s) like number of lines of code (LOC), design lines, components, and more. Launch the VBUC and point to a folder containing a *.vbp file (valid VB6 project). Then go to the Tools menu and click Assessment: Click run, and the assessment will process all the files it finds. If you get an "unresolved references" warning, you can click the "Resolve References" button on the left and resolve those references (right click the missing reference and browse to its external location). Results will appear in a browser: