Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 4 - 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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    A Wrapper Class for DML Statements Using Visual Basic.NET - Adding code to add binary data for INSERT command


    (Page 4 of 7 )

    The following is the code necessary for adding a column (of type binary) to the INSERT command.

    PublicSub addFileColumn(ByVal ColName As String, ByRef UpFile As System.Web.HttpPostedFile)
            'make sure to include this attribute in your form tag b4 using this method ...enctype="multipart/form-data"
            'change the value according to datatype
            Dim FileStream As System.IO.Stream
            Select Case m_CommandType
                Case CommandType.Insert 'INSERT command
                    Select Case m_dbObject.ConnectionType
                        Case DBConnType.MSSQL 'copy the same below in UPDATE case also
                            Dim fileLength As Integer = UpFile.ContentLength
                            If (fileLength = 0) Then
                                Throw New Exception("No information is available in selected File..try giving another existing filename")
                            End If
                            Dim FileByteArray(fileLength) As Byte
                            FileStream = UpFile.InputStream
                            FileStream.Read(FileByteArray, 0, fileLength)
                            'append this information to already existing arrays
                            If m_FileColNames Is Nothing Then
                                ReDim m_FileColNames(0)
                                ReDim m_FileByteArrays(0)
                            Else
                                ReDim Preserve m_FileColNames(UBound(m_FileColNames) + 1)
                                ReDim Preserve m_FileByteArrays(UBound(m_FileByteArrays) + 1)
                            End If
                            m_FileColNames(m_FileColNames.Length - 1) = ColName
                            m_FileByteArrays(m_FileByteArrays.Length - 1) = FileByteArray
                        Case Else
                            Throw New Exception("currently this library supports only SQL.NET Provider to upload files")
                    End Select
                    m_ColNameList = IIf(m_ColNameList = "", ColName, m_ColNameList & "," & ColName)
                    m_ColValList = IIf(m_ColValList = "", "@" & Trim(ColName), m_ColValList & ",@" & Trim(ColName))
                    'this is for oledb type
                    'm_ColValList = IIf(m_ColValList = "", "?", m_ColValList & ",?")

     

    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 1 hosted by Hostway