Login    
 
 
 
 
Text/HTML
  
You are here :: Blogs Saturday, May 19, 2012

Search
Note: This uses the internal blog search engine. The Google search engine is also available at the top of the page.
  
Disclaimer

Please review the site disclaimer before downloading or using content found on this site

  
Categories
  
DEVSHED Blog
As always, I welcome your comments!
Dec 4

Written by: Steve Gray
12/4/2009 10:03 AM  RssIcon

This is an example of how the StoredProcedure.vb and CommandParameters.vb classes are used. This code assumes that the Microsoft Enterprise Library 4.1 is installed

Note that the database is passed in, this needs to be defined in the app.config or web.config file. Refer to the Enterprise Library examples for that.

First, create for each stored procedure that you want to access a function like this:

    Public Shared Function FP_SOP10200_SEL_bySopnumbe3(ByVal strSopnumber As String, _
        ByVal intSoptype As Int32,  db as string)  As storedProcedure
        
        Dim sp As New storedProcedure("FP_SOP10200_SEL_bySopnumbe3", db)
        sp.commandParameters.Add(New commandParameter("@vchrSopnumber", _
            strSopnumber, DBType.String))
        sp.commandParameters.Add(New commandParameter("@intSoptype", _
            intSoptype, DBType.Int32))
        Return sp
    End Function

 

 

Then, call the stored procedure like this:

        Grid1.DataSource = dynData.SPs.FP_SOP10200_SEL_bySopnumbe3(strSopnumber, _ 
            intsoptype, AppUser.strLastDB).getTable

 

This is a little hard to follow, but bear with me. In step one, we create the FP_SOP10200_SEL_bySopnumbe3 function, and it returns a ‘StoredProcedure’ object. At the end of the line we add ‘.getTable’, or ‘.getReader’, or any of the methods in the StoredProcedure class.

Tags:
Categories:
As always, I welcome your comments!
  
 
 
Home | Products | Blogs | Contact Us | Links | God's Plan
Privacy Statement | Terms Of Use
 
Copyright 2011 by Devshed.us