ASP.NET
  Home arrow ASP.NET arrow Page 2 - 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 
Mobile Linux 
App Generation ROI 
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 - Understanding the class


    (Page 2 of 5 )

    This section explains the class listed in the previous section.  Let us go through it part by part.  First of all, consider the following:

    <XmlRoot("SybaseProcParameter")> _
    Public Class ASEProcParameter

    The name of the class is “ASEProcPrameter” (user-defined).  If we wanted to have this class serialized, the root of the XML would start at the  “SybaseProcParameter” element.  Even though for the above, serialization is not necessary, there are times when you want to pass the parameters between several tiers of your application.  Then you need to serialize the information before you do marshaling or un-marshaling.  In the above case, it would be automatically serialized to XML!  Further proceeding, we have the following:

    <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

    Those are all the class level variables needed to hold the parameter information of a stored procedure.  I hope the name is reasonable and you can follow accordingly.  Further proceeding, we have the following:

    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

    The above code fragment is a constructor which accepts certain information of a single parameter and passes the information to the class level variables.  Further proceeding we have:

    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

    The above is very similar to the translation of our existing parameter information to the Sybase understandable parameter.

    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

    - Disadvantages of the ASP.NET MVC Framework
    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - 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





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