Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 7 - A Wrapper Class for DML Statements Using V...
Moblin
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 
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

    Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!

    A Wrapper Class for DML Statements Using Visual Basic.NET - Completing the class


    (Page 7 of 7 )

    Before we complete the class, we need to examine two more methods. Let us consider the first one:

    PublicSub Criteria(ByVal Condition As String)
            Select Case m_CommandType
                Case CommandType.Update
                    m_SQL = Left(m_SQL, Len(m_SQL) - 1)
                    m_SQL &= " WHERE " & Condition
            End Select
        End Sub

    The above method is mainly used to add a condition to the DML command. The second is the following:

    PublicSub Clear()
            Select Case m_CommandType
                Case CommandType.Insert
                    m_SQL = "INSERT INTO "
                    m_ColValList = ""
                    m_ColNameList = ""
                    m_FileColNames = Nothing
                    m_FileByteArrays = Nothing
                Case CommandType.Update
                    m_SQL = "UPDATE "
                    m_FileColNames = Nothing
                    m_FileByteArrays = Nothing
            End Select
        End Sub

    If you wanted to clear the existing DML command frame, you can use the above command.  It is mainly used when you want to reuse the same DML object several times.

    Working with the above class is as simple as the following code:

            Dim ins As New DMLLib(DMLLib.CommandType.Insert, db)
            With ins
                .TableName = "emp"
                .addColumn("empno", "1001")
                .addColumn("ename", "jag")
                .ExecuteCommand()
            End With

    If necessary, you can even put "addColumn" in a loop to work with a larger number of columns. The only important issue is that the "TableName" must be the first assignment to the DMLLib object.

    Any feedback, suggestions, bugs, errors, improvements etc., are highly appreciated at jag_chat@yahoo.com.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

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

    VISUAL BASIC.NET ARTICLES

    - 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
    - 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...




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