0% found this document useful (0 votes)
672 views

Convert Your Datatype To ADODB Datatype

This function takes in a type and returns the corresponding ADODB data type enum by matching the underlying system type string of the input type to known .NET framework types. It contains a select case statement to map common .NET types like Boolean, Byte, String to their ADODB equivalents and returns an error message if no match is found.

Uploaded by

Muneeb Khan
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
672 views

Convert Your Datatype To ADODB Datatype

This function takes in a type and returns the corresponding ADODB data type enum by matching the underlying system type string of the input type to known .NET framework types. It contains a select case statement to map common .NET types like Boolean, Byte, String to their ADODB equivalents and returns an error message if no match is found.

Uploaded by

Muneeb Khan
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Public Function TranslateType(ByRef type As Type) As ADODB.

DataTypeEnum
Try
Select Case type.UnderlyingSystemType.ToString

Case "System.Boolean"
Return ADODB.DataTypeEnum.adBoolean

Case "System.Byte"
Return ADODB.DataTypeEnum.adUnsignedTinyInt

Case "System.Char"
Return ADODB.DataTypeEnum.adChar

Case "System.DateTime"
Return ADODB.DataTypeEnum.adDate

Case "System.Decimal"
Return ADODB.DataTypeEnum.adCurrency

Case "System.Double"
Return ADODB.DataTypeEnum.adDouble

Case "System.Int16"
Return ADODB.DataTypeEnum.adSmallInt

Case "System.Int32"
Return ADODB.DataTypeEnum.adInteger

Case "System.Int64"
Return ADODB.DataTypeEnum.adBigInt

Case "System.SByte"
Return ADODB.DataTypeEnum.adTinyInt

Case "System.Single"
Return ADODB.DataTypeEnum.adSingle

Case "System.UInt16"
Return ADODB.DataTypeEnum.adUnsignedSmallInt

Case "System.UInt32"
Return ADODB.DataTypeEnum.adUnsignedInt

Case "System.UInt64"
Return ADODB.DataTypeEnum.adUnsignedBigInt

Case "System.String"
'case default
Return ADODB.DataTypeEnum.adVarWChar

End Select

Catch ex As Exception
MsgBox(ex.Message)
End Try

End Function

You might also like