- INDEX VB TO NET
- VBUC FEATURES
- LEGACY DATA ACCESS MODERNIZATION
- RDO TO DATA.COMMON
RDO to Data.Common with helpers
Related Content
- ADO to ADO.NET Common
- ADO to .NET Native SqlClient
- How does the VBUC convert ADO
- RDO to ADO.Net System.Data.Common
- RDO Special Conversions
The VBUC is able to port the RDO data access code to ADO.NET by means of the System.Data.Common namespace. This technique is used in the following way:
- RDO connecting to SQLserver: this scenario can be upgraded using the previous option as well, although this option achieves higher automation ratios.
- RDO connecting to any other provider: when RDO is used to connect to any other data provider besides SQLserver (Jet, ODBC,…) this option MUST be used.
The member transformation for this data access technology is described as follows:
Class | Maps to |
RDO.rdoConnection | System.Data.Common.DbConnection |
RDO.rdoResultset | Artinsoft.VB6.DB.RDO.RDORecordSetHelper |
RDO.rdoColumns | System.Data.DataColumnCollection |
RDO.rdoParameter | System.Data.Common.DbParameter |
RDO.rdoParameters | System.Data.Common.DbParameterCollection |
RDO.rdoPreparedStatement | System.Data.Common.DbCommand |
RDO.rdoQuery | System.Data.Common.DbCommand |
RDO.rdoEngine | Artinsoft.VB6.DB.RDO.RDOEngineHelper |
RDO.rdoEnvironment | Artinsoft.VB6.DB.RDO.RDOEnvironmentHelper |
RDO.rdoColumn | System.Data.DataColumn |
RDO.DataTypeConstants | System.Data.DbType |
RDO.LockTypeConstants | Artinsoft.VB6.DB.RDO.LockTypeConstants |
RDO.QueryTypeConstants | System.Data.CommandType |
Support for MSRDC data control is added into this feature using the Common namespace:
Class | Maps to |
MSRDC.MSRDC | Artinsoft.VB6.DB.RDO.RDODataControlHelper |
Original VB6 Code:
Public recRecordset As RDO.rdoResultset Public RDOConnection As New RDO.RDOConnection Private Sub Form_Load() Set RDOConnection = New RDO.RDOConnection RDOConnection.CursorDriver = rdUseClientBatch RDOConnection.Connect = "DSN=TestDB;UID=;PWD=;Database=TestDB" RDOConnection.EstablishConnection rdDriverNoPrompt, False Set recRecordset = RDOConnection.OpenResultset("select * from Countries", rdOpenKeyset, _ rdConcurBatch) recRecordset.MoveFirst End Sub
Resulting VB.NET Code:
Public recRecordset As RDORecordSetHelper Private _RDOConnection As DbConnection = Nothing Private Sub Form1_Load(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles MyBase.Load RDOConnection = Artinsoft.VB6.DB.AdoFactoryManager.GetFactory().CreateConnection() 'UPGRADE_ISSUE: (2064) RDO.CursorDriverConstants property CursorDriverConstants.rdUseClientBatch was not upgraded. More Information: http://www.vbtonet.com/ewis/ewi2064.aspx 'UPGRADE_ISSUE: (2064) RDO.RDOConnection property RDOConnection.CursorDriver was not upgraded. More Information: http://www.vbtonet.com/ewis/ewi2064.aspx UpgradeStubs.RDO_rdoConnection.setCursorDriver(RDOConnection, UpgradeStubs.RDO_CursorDriverConstants.getrdUseClientBatch()) RDOConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\TestDB.mdb" RDOConnection.Open() recRecordset = RDORecordSetHelper.Open("select * from Countries", RDOConnection, LockTypeConstants.rdConcurBatch, "") recRecordset.MoveFirst() End Sub
Note that the connection String (gray highlight) was manually added after the automated migration stage.
Resulting C#.NET Code:
public RDORecordSetHelper recRecordset = null; private DbConnection _RDOConnection = null; private void Form1_Load( Object eventSender, EventArgs eventArgs) { RDOConnection = Artinsoft.VB6.DB.AdoFactoryManager.GetFactory().CreateConnection(); //UPGRADE_ISSUE: (2064) RDO.CursorDriverConstants property CursorDriverConstants.rdUseClientBatch was not upgraded. More Information: http://www.vbtonet.com/ewis/ewi2064.aspx //UPGRADE_ISSUE: (2064) RDO.RDOConnection property RDOConnection.CursorDriver was not upgraded. More Information: http://www.vbtonet.com/ewis/ewi2064.aspx UpgradeStubs.RDO_rdoConnection.setCursorDriver(RDOConnection, UpgradeStubs.RDO_CursorDriverConstants.getrdUseClientBatch()); RDOConnection.ConnectionString = "DSN=TestDB;UID=;PWD=;Database=TestDB"; RDOConnection.Open(); recRecordset = RDORecordSetHelper.Open("select * from Countries", RDOConnection, LockTypeConstants.rdConcurBatch, ""); recRecordset.MoveFirst(); DisplayInfo(); }