New Listings

Most Popular

Top Ranked

Link to Us

Search

Site Map
  Search for
  Advanced Search
  Home |Add a Link | Modify a Link | Login | Register | Advertise | About Us
Categories
Ajax Scripts
ASP NET Scripts
ASP Scripts
C and C++ Scripts
Coldfusion Scripts
Flash Scripts
Java Scripts
JavaScript Scripts
Perl Scripts
PHP Scripts
Python Scripts
Remotely Hosted Scripts
Tools and Utilities Scripts
XML Scripts

Most Popular This Week
1. Remember Me!5
2. ASPProtect4
3. X-Login3
4. Dataaccess layer2
5. AspUser1

Most Popular This Month
1. ASPProtect16
2. Remember Me!15
3. X-Login13
4. User Manager10
5. Keyvan1 Advanced Membership(updated)7

Home : ASP Scripts : User Management Scripts : Dataaccess layer
Dataaccess layerHits: 161

Visit Dataaccess layer `s Website Refer
Write a Review! Report This Link
Description: Imports SystemImports System.DataImports System.Data.SqlClientImports System.DiagnosticsNamespace DAL Public Class DataAccess Implements IDisposable Private strConnection As String = ConfigurationSettings.AppSettings("conString") Private command As SqlCommand Public Sub New(ByVal sprocName As String, ByVal commandType As CommandType, Optional ByVal parameters As SqlParameter() = Nothing) command = New SqlCommand(sprocName, New SqlConnection(strConnection)) command.CommandType = commandType If Not IsNothing(parameters) Then Dim parameter As SqlParameter For Each parameter In parameters command.Parameters.Add(parameter) Next End If command.Connection.Open() End Sub Public Sub New(ByVal sprocName As String, ByVal parameters As ArrayList) command = New SqlCommand(sprocName, New SqlConnection(strConnection)) command.CommandType = CommandType.StoredProcedure Dim parameter As SqlParameter For Each parameter In parameters command.Parameters.Add(parameter) Next command.Connection.Open() End Sub Public Function runNonQuery_Int() As Int32 If IsDBNull(command) Then Throw New ObjectDisposedException("Object is disposed") End If Dim retVal As Integer = 0 retVal = command.ExecuteNonQuery() Return retVal End Function Public Function runUpadateQuery_Int(Optional ByVal strRetParamName As String = "") As Int32 If IsDBNull(command) Then Throw New ObjectDisposedException("Object is disposed") End If Dim i As Integer i = command.ExecuteNonQuery() If i = 0 Then Return 0 Else If strRetParamName = "" Then Return i Else Return command.Parameters("@" & strRetParamName).Value End If End If End Function Public Function runScalar_Obj() As Object If IsDBNull(command) Then Throw New ObjectDisposedException("Object is disposed") End If Return (command.ExecuteScalar()) End Function Public Function runReader_Rd() As SqlDataReader Dim rdr As SqlDataReader If IsDBNull(command) Then Throw New ObjectDisposedException("Object is disposed") End If rdr = command.ExecuteReader() Return rdr End Function Public Function runAdapter_Dt() As DataTable 'hh If IsDBNull(command) Then Throw New ObjectDisposedException("Object is disposed") End If Dim dataAdapter As SqlDataAdapter Dim dataTable As DataTable dataAdapter = New SqlDataAdapter dataTable = New DataTable dataAdapter.SelectCommand = command dataAdapter.Fill(dataTable) dataAdapter.Dispose() Return dataTable End Function Public Sub Dispose() Implements System.IDisposable.Dispose If Not IsDBNull(command) Then Dim tmpsqlcon As SqlConnection tmpsqlcon = command.Connection Debug.Assert(Not IsDBNull(tmpsqlcon)) command.Dispose() tmpsqlcon.Dispose() End If End Sub End ClassEnd Namespace


Resource Specification
Version:1
Platform:Windows
Price:Freeware
Date Added:31/10/2006
Last Updated:31/10/2006
Author:Tatvasoft

Average Visitor Rating: Not Yet Rated

Visitor Voting

Average Member Rating: Not yet reviewed by any member...
You can be the first one to write a review for Dataaccess layer!
Sponsored Ads

Partner Links
Optel

Software Download

Free Web Hosting

Cruised Web Directory

Newsgroups Archives

Mirroraty

SEO Consulting UK

Hardware Keylogger

Targeted Website Traffic

Paracoda Web


Powered By TheDesigner
Scriptaty.net (C) 2007