Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

GetOleDbType - Retrieving the OleDbType for the specified system type

Total Hit ( 4287)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Click here to copy the following block
' Return the OleDbType that represents the specified system type
' This is particularly useful when you have a DataTable and want to create a
' OleDbParameter for onw of its columns, but don't know its type.
' DataColumnName.DataType returns a Type, and you can convert it to OleDbType
' by passing it to this function.
' Note: requires System.Data.OleDb
' Example:
'  Dim param As New OleDbParameter("TestCol", GetOleDbType(String))
Private Function GetOleDbType(ByVal sysType As Type) As OleDbType
  If sysType Is GetType(String) Then
    Return OleDbType.VarChar
  ElseIf sysType Is GetType(Integer) Then
    Return OleDbType.Integer
  ElseIf sysType Is GetType(Boolean) Then
    Return OleDbType.Boolean
  ElseIf sysType Is GetType(Date) Then
    Return OleDbType.Date
  ElseIf sysType Is GetType(Char) Then
    Return OleDbType.Char
  ElseIf sysType Is GetType(Decimal) Then
    Return OleDbType.Decimal
  ElseIf sysType Is GetType(Double) Then
    Return OleDbType.Double
  ElseIf sysType Is GetType(Single) Then
    Return OleDbType.Single
  ElseIf sysType Is GetType(Byte()) Then
    Return OleDbType.Binary
  ElseIf sysType Is GetType(Guid) Then
    Return OleDbType.Guid
  End If
End Function


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.