Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 6 - A Wrapper Class for DML Statements Using V...
IBM developerWorks
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 
VeriSign Whitepapers 
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

    At the virtual BlackBerry Technical Seminar 2008, you can ask your development questions directly of Research In Motion® (RIM) experts, and take advantage of learning opportunities designed uniquely for BlackBerry solution developers. Register Today!

    A Wrapper Class for DML Statements Using Visual Basic.NET - Executing the DML command


    (Page 6 of 7 )

    Once the DML command is framed, we need to execute it with a separate method.  The method looks something like the following:

    PublicSub ExecuteCommand()
            If m_FileColNames Is Nothing Then 'if no images exist in the command
                m_dbObject.SQLExecute(Me.GeneratedSQLCommand)
            Else 'insert images as well
                m_dbObject.SQLExecute(Me.GeneratedSQLCommand, m_FileColNames, m_FileByteArrays)
            End If
        End Sub

    The above method works with another method called "GeneratedSQLCommand," which is defined as follows:

    PublicReadOnly Property GeneratedSQLCommand()
            Get
                Select Case m_CommandType
                    Case CommandType.Insert
                        m_SQL = Replace(m_SQL, "()", "(" & m_ColNameList & ")", , 1)
                        m_SQL = Replace(m_SQL, "()", "(" & m_ColValList & ")")
                    Case CommandType.Update
                        If InStr(m_SQL, " WHERE ") = 0 Then
                            Return Left(m_SQL, Len(m_SQL) - 1)
                        End If
                End Select
                Return m_SQL
            End Get
        End Property

    The method "ExecuteCommand" executes the DML command with the help of my data helper class provided in my previous articles. You can embed your own logic to execute the DML command at that point.

    More Visual Basic.NET Articles
    More By Jagadish Chaterjee


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

    VISUAL BASIC.NET ARTICLES

    - 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...
    - Programmatically Controlling Windows Fax Ser...
    - Focusing on Forms and Menus in Visual Basic

    SunQuest




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