×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
What are the advantages of using the IBM .NET provider over OLE or ODBC?
I have been going thought the assembly and the only benefit I see is the
IBM data types and tracing. The only issue I ran into is converting
byte arrays into string. Here is my solution:
Private Function getTable(ByVal SelectCommand As String, ByVal
Connection As iDB2Connection, Optional ByVal convertByte As Boolean =
True) As DataTable
Dim cmd As New iDB2Command(SelectCommand, Connection)
Dim da As New iDB2DataAdapter(cmd)
Dim ds As New DataSet
Try
da.Fill(ds, "table0")
If ds.Tables("table0").Rows.Count = 0 Then
Return New DataTable
ElseIf ds.Tables("table0").Rows.Count > 0 And Not
convertByte Then
Return ds.Tables("table0")
Else
Dim table1 As New DataTable("table1")
' Parse column data types from Table0 to Table1
For Each dc0 As DataColumn In
ds.Tables("table0").Columns
Dim dc1 As New DataColumn(dc0.ColumnName,
dc0.DataType)
If dc1.DataType Is GetType(Byte()) Then
dc1.DataType = GetType(String)
End If
table1.Columns.Add(dc1)
Next
ds.Tables.Add(table1)
' Parse all data from Table0 to Table1
For Each dr0 As DataRow In ds.Tables("table0").Rows
Dim dr1 As DataRow = table1.NewRow()
For i = 0 To dr0.ItemArray.Count - 1
' Convert Byte() to String
' Not sure if other datatypes need some
conversion
If TypeOf (dr0(i)) Is Byte() Then
Dim byteArray As Byte() = dr0(i)
Dim field0 As New iDB2CharBitData(byteArray)
dr1(i) = field0.ToString(37)
Else
dr1(i) = dr0(i)
End If
Next
table1.Rows.Add(dr1)
Next
Return table1
End If
Catch ex As Exception
Console.WriteLine(ex.Message)
Return New DataTable
End Try
End Function
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.