Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 2 - 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 
Actuate Whitepapers 
Moblin 
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

    Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    A Wrapper Class for DML Statements Using Visual Basic.NET - The beginning of the class


    (Page 2 of 7 )

    Let us first go through the following code:

    PublicClass DMLLib
    ...   

        Private m_SQL As String = ""
        Private m_dbObject As Object = Nothing 'this should be either
    'WebLib' or 'WinLib' objects
        Private m_ColNameList As String = ""
        Private m_ColValList As String = ""
        Private m_CommandType As CommandType
        'only for storing files directly in database 
        Private m_FileColNames() As String = Nothing 'to hold all
    column names to which files are to be uploaded
        Private m_FileByteArrays() As Object = Nothing 'the content
    of each file to be uploaded..

        Public Sub New(ByVal DMLCommandType As CommandType, ByRef
    dbObject As Object) 'dbObject should be either 'WebLib' or
    'WinLib' objects
            If dbObject Is Nothing Then
                Throw New Exception("DBLib Object is currently
    nothing"
    )
            End If
            m_dbObject = dbObject
            m_CommandType = DMLCommandType
            Select Case DMLCommandType
                Case CommandType.Insert
                    m_SQL = "INSERT INTO "
                Case CommandType.Update
                    m_SQL = "UPDATE "
            End Select
        End Sub

    The above code contains the constructor, which accepts two parameters. The first is "CommandType" and the second is the "database" object.  Based on the command type, I initially started with the command itself.

    To provide the table name, I created the following property:

    PublicWriteOnly Property TableName()
            Set(ByVal Value)
                Select Case m_CommandType
                    Case CommandType.Insert
                        m_SQL &= Value & " () VALUES ()"
                    Case CommandType.Update
                        m_SQL &= Value & " SET "
                End Select
            End Set
        End Property

    More Visual Basic.NET Articles
    More By Jagadish Chaterjee


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

    VISUAL BASIC.NET ARTICLES

    - Movement and Player Statistics in a VB.NET T...
    - Creating and Drawing a Game Map in VB.NET
    - 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 ...
    - Overloading and Overriding in Visual Basic.N...
    - More on Controlling Windows Fax Services Usi...





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