ASP.NET
  Home arrow ASP.NET arrow Developing a Data Access Layer for Sybase ...
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 
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? 
ASP.NET

Developing a Data Access Layer for Sybase using ADO.NET: Working With Stored Procedures
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 5
    2006-04-03

    Table of Contents:
  • Developing a Data Access Layer for Sybase using ADO.NET: Working With Stored Procedures
  • Understanding the class
  • Adding a parameter before executing a Sybase stored procedure
  • Retrieving a data table by executing a Sybase stored procedure: the code
  • Retrieving a data table by executing a Sybase stored procedure: explanation

  • 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


    Developing a Data Access Layer for Sybase using ADO.NET: Working With Stored Procedures


    (Page 1 of 5 )

    This article is third and last in a series focusing on developing a simple DAL (Data Access Layer) for any database using ADO.NET. In this series, we consider Sybase as the database of choice for developing the DAL.

    I enclosed the source code in the form of a single file (“.vb” file).  You can use it straight away or extend it further based on your needs.  The entire discussion in this article will be based on version .NET 1.1.

    If you are new to configuring Sybase for .NET or new to this series, I strongly suggest you refer to my first article of this series here.

    Developing a separate class to hold all parameters of a Sybase stored procedure

    In my previous two articles, you saw several methods for retrieving information from a Sybase database.  In this article we shall focus on retrieving information using stored procedures available within Sybase database.

    In the case of stored procedures, sometimes we may need to execute them by passing some parameters (related to the stored procedure itself).  When we want to pass some parameter to a stored procedure, we need to know the parameter name, data type, size, and other details.

    To hold all such information (sometimes called the parameter cache), I developed a separate class. The complete listing of the class is as follows:

    <XmlRoot("SybaseProcParameter")> _
    Public Class ASEProcParameter
     
        <XmlElement("ParameterName", GetType(String))> _
        Public ParameterName As String
     
        <XmlElement("ParameterValue", GetType(Object))> _
        Public ParameterValue As Object
     
        <XmlElement("ParameterDataType", GetType(AseDbType))> _
        Public ParameterDataType As AseDbType
     
        <XmlElement("ParameterSize", GetType(Integer))> _
        Public ParameterSize As Integer
     
        <XmlElement("ParameterDirectionUsed", GetType
    (ParameterDirection))> _
        Public ParameterDirectionUsed As ParameterDirection
     
        Public Sub New()
     
        End Sub
     
        Public Sub New(ByVal passedParameterName As String, _
                 ByVal passedValue As Object, _
                Optional ByVal passedSQLType As AseDbType = Nothing,
    _
                Optional ByVal passedSize As Integer = Nothing, _
                Optional ByVal passedDirection As ParameterDirection
    = ParameterDirection.Input)
     
            ParameterName = passedParameterName
            ParameterValue = passedValue
            ParameterDataType = passedSQLType
            ParameterSize = passedSize
            ParameterDirectionUsed = passedDirection
        End Sub
     
        Public Function getASEParameter() As AseParameter
            Dim returnSQLParameter As AseParameter = New AseParameter
            returnSQLParameter.ParameterName = ParameterName
            returnSQLParameter.Value = ParameterValue
            returnSQLParameter.AseDbType = ParameterDataType
            returnSQLParameter.Size = ParameterSize
            returnSQLParameter.Direction = ParameterDirectionUsed
            Return returnSQLParameter
        End Function
     
    End Class

    The next section gives you a complete understanding of the class listed above.

    More ASP.NET Articles
    More By Jagadish Chaterjee


       · Hello guys, I extended the "Data Access Layer for Sybase" to work with Stored...
     

    ASP.NET ARTICLES

    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX
    - Building a Simple Storefront with LINQ
    - Developing a Dice Game Using ASP.NET Futures...
    - Completing an ASP.NET AJAX Server-Centric Ba...
    - Information Management for an ASP.NET AJAX S...
    - Comment and Order Management for an ASP.NET ...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT