Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 3 - A Wrapper Class for DML Statements Using V...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

A Wrapper Class for DML Statements Using Visual Basic.NET
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 11
    2006-08-16

    Table of Contents:
  • A Wrapper Class for DML Statements Using Visual Basic.NET
  • The beginning of the class
  • Adding a column to the INSERT or UPDATE command
  • Adding code to add binary data for INSERT command
  • Adding code to add binary data for UPDATE command
  • Executing the DML command
  • Completing the class

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    A Wrapper Class for DML Statements Using Visual Basic.NET - Adding a column to the INSERT or UPDATE command


    (Page 3 of 7 )

    The following is the code necessary for adding a new column to the respective DML command:

    PublicSub addColumn(ByVal ColName As String, ByVal ColValue As
    String, Optional ByVal ColType As DataType =
    DataType.CharacterType)
            'change the value according to datatype
            Select Case m_CommandType
                Case CommandType.Insert 'INSERT command
                    Select Case ColType
                        Case DataType.CharacterType
                            ColValue = "'" & ColValue & "'"
                        Case DataType.DateType
                            Dim s As String = Format(CDate(ColValue),
    "yyyy/MM/dd")
                            Select Case m_dbObject.ConnectionType
                                Case DBConnType.MSSQL
                                    ColValue = "'" & s & "'"
                                    'Case "JET"
                                    'ColValue = "#" & s & "#"
                                Case Else
                                    ColValue = "'" & s & "'"
                            End Select
                        Case DataType.NumericType
                            ColValue = ColValue
                    End Select
                    If m_ColNameList = "" Then
                        m_ColNameList = ColName
                    Else
                        m_ColNameList &= ", " & ColName
                    End If
                    If m_ColValList = "" Then
                        m_ColValList = ColValue
                    Else
                        m_ColValList &= ", " & ColValue
                    End If
                Case CommandType.Update 'UPDATE command
                    Select Case ColType
                        Case DataType.CharacterType
                            m_SQL &= ColName & "='" & ColValue & "',"
                        Case DataType.DateType
                            Dim s As String = Format(CDate(ColValue),
    "yyyy/MM/dd")
                            Select Case m_dbObject.ConnectionType
                                Case DBConnType.MSSQL
                                    m_SQL &= ColName & "='" & s &
    "',"
                                    'Case "JET"
                                    '    m_SQL &= ColName & "=#" & s
    & "#,"
                            End Select
                        Case DataType.NumericType
                            m_SQL &= ColName & "=" & ColValue & ","
                    End Select
            End Select
        End Sub

    More Visual Basic.NET Articles
    More By Jagadish Chaterjee


       · Hai guys! enjoy the DML wrapper included in this contribution.
     

    VISUAL BASIC.NET ARTICLES

    - Create a Sudoku Puzzle Generator using VB.NET
    - Entity Creation and Messaging in a VB.NET Te...
    - Movement and Player Statistics in a VB.NET T...
    - Creating and Drawing a Game Map in VB.NET (F...
    - Working with Classes and Properties for Game...
    - Working with Loops, Arrays, and Collections ...
    - Learning Loops in VB.NET for Game Development
    - Learning VB.NET: Working with Variables, Con...
    - The Basics of VB.NET Through Text Game Devel...
    - Learning VB.NET Through Text Game Development
    - Types of Operators in Visual Basic
    - Operators
    - Understanding Custom Events using Visual Bas...
    - Polymorphism using Abstract Classes in Visua...
    - Shadowing using Shadows in Visual Basic.NET ...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway