Visual Basic.NET
  Home arrow Visual Basic.NET arrow 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  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
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


    (Page 1 of 7 )

    This article explains several techniques for working with DML statements in a flexible manner, without worrying much about the syntactical errors.
    A downloadable file for this article is available here.

    The entire source code for this article is available in the form of downloadable zip.  The solution was developed using Microsoft Visual Studio 2003 Enterprise Architect with Microsoft SQL Server 2005 Developer Edition on Microsoft Windows Server 2003 Enterprise Edition.  Even though I believe that the source code available with this contribution can work with Microsoft Visual Studio.NET 2002, I didn't really test it in any other environment. I request that you post in the discussion area if you have any problems with execution.

    What exactly is this DML support class doing?

    In several applications, we use DML statements which execute dynamically. If we are working with an INSERT statement that has too many columns, it would be rather daunting. The same would be true for an UPDATE statement with many columns.

    To solve all these issues, I developed a simple wrapper class specifically to work with DML statements flexibly. As part of what was needed, I declared the following enumerations:

    PublicEnum CommandType
            Insert
            Update
        End Enum
    PublicEnum DataType
            NumericType
            CharacterType
            DateType
    EndEnum

    When we work with a DML statement, it would be generally an INSERT, UPDATE or DELETE (putting SELECT aside). DELETE is very simple and I simply don't want to handle it in this class. That is why I declared only "Insert" and "Update" as part of the "Command Type."

    When working with DML commands, the syntax will be different based on the data types. To support different data types, I declared the above enumeration.

    To execute the DML command, I am using the Data Helper class developed by me in my previous articles. If you want to include your own code, I request that you  go ahead by forgetting the data helper code. You can also modify this class with respect to Microsoft Data Access Blocks.

    More Visual Basic.NET Articles
    More By Jagadish Chaterjee


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

    VISUAL BASIC.NET ARTICLES

    - User-defined Functions using Visual Basic Ap...
    - Understanding Object Binding in VBA
    - Mastering the Message Box
    - Testing a Windows Forms Application
    - Using Visual Basic.NET Features to Code a Wi...
    - Correcting Code in a Windows Forms Applicati...
    - Write Readable Code and Comments for Windows...
    - How to Code and Test a Windows Forms Applica...
    - Adding Features to a Windows Forms Applicati...
    - How to Design a Windows Forms Application
    - LINQ to XML Programming Using Visual Basic.N...
    - Understanding Delegates using Visual Basic.N...
    - 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...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek