RDO to ADO.NET
The RDO data access model can be mapped to .NET using 2 different methodologies,
the behavior of this particular option is described as follows:
- RDO connecting to SQLserver: This solution generates helper-free source code, however,
there are many functional details that require manual implementation. We recommend
using the next option since most of the lost functionality is implemented into the
helper classes.
- RDO connecting to any other provider: when ADO is used to connect to any other data
provider besides SQLserver (Jet, ODBC,...) this option CANNOT be used. The next
option must be compulsory used.
The member transformation for this data access technology is described as follows:
|
RDO.rdoConnection
|
System.Data.SqlClient.SqlConnection
|
|
RDO.rdoResultset
|
System.Data.DataSet
|
|
RDO.rdoColumns
|
The property “rdoColumns.item” is the only supported member of this class.
|
|
RDO.rdoError
|
System.Data.SqlClient.SqlError
|
|
RDO.Parameter
|
System.Data.SqlClient.SqlParameter
|
|
RDO.Parameters
|
System.Data.SqlClient.SqlParameterCollection
|
|
RDO.rdoPreparedStatement
|
System.Data.SqlClient.SqlCommand
|
|
RDO.rdoQuery
|
System.Data.SqlClient.SqlCommand
|
The RDO to ADO.NET upgrade also covers the possibility to use the MSRDC control
for this particular technology. The mappings are described below:
|
MSRDC.MSRDC
|
Artinsoft.VB6.Gui.DataHelper
|
In addition, conversion rules apply changes over specific pattern in the source
code related to RDO code:
|
RDO Resultset loops
|
- Conversion to foreach iterations
- Conversion to Datareader (applied if the recordset is used to read information only).
|
A brief source sample of this feature:
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 = "uid=ftt_uwee;pwd=fttuwee;driver={SQL SERVER}; server=AISCRIT11\FTT;database=Northwind;"
RDOConnection.EstablishConnection rdDriverNoPrompt, False
Set recRecordset = RDOConnection.OpenResultset("select * from Customers", rdOpenKeyset, _
rdConcurBatch)
recRecordset.MoveFirst
End Sub
Resulting VB.NET Code:
Public recRecordset As DataSet
Private _RDOConnection As SqlConnection = Nothing
Private Sub Form1_Load(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles MyBase.Load
RDOConnection = New SqlConnection()
RDOConnection.CursorDriver = RDO.CursorDriverConstants.rdUseClientBatch
RDOConnection.Connect = "uid=ftt_uwee;pwd=fttuwee;driver={SQL SERVER}; server=AISCRIT11\FTT;database=Northwind;"
RDOConnection.EstablishConnection(RDO.PromptConstants.rdDriverNoPrompt, False)
Dim tempAdapter As SqlDataAdapter = New SqlDataAdapter("select * from Customers", RDOConnection)
recRecordset = New DataSet
tempAdapter.Fill(recRecordset)
'UPGRADE_ISSUE: (1040) MoveFirst function is not supported. More Information: http://www.vbtonet.com/ewis/ewi1040.aspx
UpgradeStubs.RDO_rdoResultset.MoveFirst(recRecordset)
End Sub
Resulting C#.NET Code:
public DataSet recRecordset = null;
private SqlConnection _RDOConnection = null;
private void Form1_Load( Object eventSender, EventArgs eventArgs)
{
RDOConnection = new SqlConnection();
RDOConnection.CursorDriver = RDO.CursorDriverConstants.rdUseClientBatch;
RDOConnection.Connect = "uid=ftt_uwee;pwd=fttuwee;driver={SQL SERVER}; server=AISCRIT11\\FTT;database=Northwind;";
RDOConnection.EstablishConnection(RDO.PromptConstants.rdDriverNoPrompt, false, null);
SqlDataAdapter tempAdapter = new SqlDataAdapter("select * from Customers", RDOConnection);
recRecordset = new DataSet();
tempAdapter.Fill(recRecordset);
//UPGRADE_ISSUE: (1040) MoveFirst function is not supported. More Information: http://www.vbtonet.com/ewis/ewi1040.aspx
UpgradeStubs.RDO_rdoResultset.MoveFirst(recRecordset);
}
In comparison, this data access migration technique offers a limited conversion ratio and requires considerably more human efforts to achieve functional equivalence than the System.Data.Common approach. The main reason behind this situation is the lack of helper classes.