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
Related:
User Reviews:
Related:
ActiveX UserManager 1.VFeatures Include: User account and group manipulation, Add and remove users and groups, Add and remove user from a group. Domain servers... |
Shareware |
ActiveX Windows group and user account Manager 2.IIIContains simple objects for creating, deleting, managing and enumerating user accounts, groups, servers and domains. You can change any of the user...By: PSTRUH Software |
Shareware |
Advanced Password ProtectionThis is a program where the password protecting facility is provided for the users to protect their website. The user have the ability to add this...By: H Script |
Shareware |
Advanced Website Password Protection -Easily add password protection to an entire website supporting Active Server Pages.By: powerasp.com |
Shareware |
AJLogin Ultra-Lite 1AJLogin Ultra-Lite is Windows compatible. AJLogin is a user friendly user management/user authentication. This script has just undergone a complete... |
Freeware |
XLSReadWriteII.NET 2.00XLSReadWriteII.NET for Delphi 2005/2006 and others, Win Forms Use this version for creating Win Forms applications with Delphi, Visual Studio and...By: Axolot Data |
Shareware |
TGPS 1.11Interface with your GPS receiver.By: Axolot Data |
Shareware |
pgISQL (Interactive SQL for PostgreSQL) ver. 2.2.0 2.2.0Interactive SQL for PostgreSQL is a powerfull database utility. It allows: Build SQL queries using SQL Editor with SQL syntax highlighting and SQL...By: Sujit |
Shareware |
Syndicate Pro 1.0Syndicate Pro multi-platform compatible. Syndicate Pro is server software for managing and distributing news headlines and other content over the ...By: Sujit |
Shareware |
ESBPCS for VCL 4.2.2ESB Professional Computation Suite (ESBPCS for VCL) provides a huge collection of Borland Delphi Routines and Components to make Data Entry and...By: Glenn Crouch |
Shareware |
- DCOM and CORBA Side by Side, Step By Step, and Layer by Layer
DCOM/CORBA Comparison. - Foundation Layer
An OO CASE tool for automatic generation of business objects code. The generated code supports the life cycle operations... - Layer One cabling
computer network cabling and voice cabling services - Layer 1 Software
Network Performance Software. - Top Layer Networks
Manufacturer of network IPS (Intrusion Prevention Systems) hardware. ASIC-designed devices help prevent attacks such as... - Transport Layer Security Charter
The IETF Working Group is responsible for developing the TLS Protocol which is intended to replace SSL. - POSIX Emulation Layer for WindowsThreads
This package provides a POSIX layer on top of Win32 threads to facilitate porting of Unix applications to Win32 platforms.... - PW32 the POSIX-over-Win32 layer
Implementation and subset of POSIX/Unix API for Win32 systems. Focus: efficiency, full platform coverage, with good... - NetworkWorld: Evolution of application layer firewalls
Article on deep packet inspection firewalls and their efficacy against worms and other malicious traffic. - JavaScript based Layer Emulation Library
LAPI - the Layer API for Gecko. A JavaScript based code that provides the Layer object and the Netscape Navigator version...
