SQLHelper/SQLHelper2.vb

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

Imports System
Imports System.Data 
Imports System.Data.SqlClient 
Imports System.Configuration.ConfigurationSettings
Imports System.ComponentModel

Public Class SQLHelper2
    Private myConnection As SqlConnection = Nothing
    Private ReadOnly RETURNVALUE As String = "RETURNVALUE"
    Private Sub Open()
        If myConnection Is Nothing Then
            myConnection = New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("SqlConn2").ToString())
        End If
        If myConnection.State = ConnectionState.Closed Then
            Try

                myConnection.Open()
            Catch ex As Exception
            Finally
            End Try
        End If
    End Sub

    Public Sub Close()
        If myConnection IsNot Nothing Then
            If myConnection.State = ConnectionState.Open Then
                myConnection.Close()
            End If
        End If
    End Sub

    Public Sub Dispose()
        If myConnection IsNot Nothing Then
            myConnection.Dispose()
            myConnection = Nothing
        End If
    End Sub

    Public Function RunProc(ByVal procName As String) As Integer
        Dim cmd As SqlCommand = CreateProcCommand(procName, Nothing)
        cmd.CommandTimeout = 0
        Try

            cmd.ExecuteNonQuery()
        Catch ex As Exception

        Finally

            Close()
        End Try

        Return CInt(cmd.Parameters(RETURNVALUE).Value)
    End Function


    Public Function RunProc(ByVal procName As String, ByVal prams As SqlParameter()) As Integer
        Dim cmd As SqlCommand = CreateProcCommand(procName, prams)
        cmd.CommandTimeout = 0
        Try
            'test
后面还有 235 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。