Site Search:
Sign in | Join | Help
4Penny.net

ASP.NET

Notes, Tricks and Tips on ASP.NET Coding

Sample data access class

Here is sample code for creating a data access class. It's not ground breaking code <smiles>, it's just handy to have it here when I start a new project

 Imports System.Data
Imports Microsoft.ApplicationBlocks.Data
Imports System.Data.SqlClient
Public Class facIV00300
    Dim m_cs As String
    Public Property ConnectionString() As String
        Get
            Return m_cs
        End Get
        Set(ByVal value As String)
            m_cs = value
        End Set
    End Property
    Sub New(ByVal connectionString As String)
        m_cs = connectionString
    End Sub
    Sub New()
    End Sub



    Function IV00300_SEL_byItem(ByVal strItemNumber As String, ByVal strLocationCode As String) As SqlDataReader


        Return SqlHelper.ExecuteReader(m_cs, CommandType.StoredProcedure, "_4P_myProc", _
                New SqlParameter("@Itemnmbr", strItemNumber), _
                New SqlParameter("@locncode", strLocationCode))


    End Function


 



End Class

Comments

No Comments

About Steve Gray

Steve is a seasoned (translate: old) developer in VB and ASP.NET. He spends most of his time in Dynamics GP, writing custom mods for consulting firms. Crystal reports, eConnect, VS Tools for Dynamics... anything that comes along.