Current Path : G:/PleskVhosts/mpcdp.in/cmamp.mpcdp.in/cdpp3/App_Code/ |
Windows NT SG2NWVPWEB022 10.0 build 17763 (Windows Server 2016) i586 |
Current File : G:/PleskVhosts/mpcdp.in/cmamp.mpcdp.in/cdpp3/App_Code/DBL.vb |
Imports System Imports System.Xml Imports System.Data Imports System.Data.SqlClient Imports System.Web.Security Imports System.Threading Imports CrystalDecisions.Shared Imports CrystalDecisions.CrystalReports.Engine Imports Microsoft.VisualBasic Public Class DBL Public cn As New SqlConnection Private SQLTransaction As SqlTransaction Dim DataReader As SqlDataReader Dim SQL As String Private Connection As SqlConnection Private sqlCommand As SqlCommand Private Shared ConnectionString As [String] = ConfigurationManager.ConnectionStrings("dsn").ConnectionString 'General.GetAppSetting("ConnectionString") Private _Closed As Boolean = True Public Sub New(ByVal CommandText As String, ByVal isStoredProcedure As Boolean) Connection = New SqlConnection(ConnectionString) sqlCommand = New SqlCommand(CommandText, Connection) ' sqlCommand.CommandType = If(isStoredProcedure, CommandType.StoredProcedure, CommandType.Text) ' If sqlCommand.CommandType = isStoredProcedure Then If isStoredProcedure = True Then sqlCommand.CommandType = CommandType.StoredProcedure Else sqlCommand.CommandType = CommandType.Text End If sqlCommand.CommandTimeout = 300 End Sub Public ReadOnly Property Parameters() As SqlParameterCollection Get Return sqlCommand.Parameters End Get End Property Public Function ExecuteNonQuery() As Integer Dim Result As Integer = -1 Try ' Connection.Open(); Open(Connection) Result = sqlCommand.ExecuteNonQuery() Finally Connection.Close() End Try Return Result End Function Public Shared Sub Open(ByVal Connection As SqlConnection) Try Connection.Open() Catch ' TODO: - 1 Log connection fail records Try Connection.ConnectionString = ConnectionString & ";Pooling=false" Connection.Open() Catch Connection.ConnectionString = ConnectionString & ";Pooling=false" Connection.Open() End Try End Try End Sub End Class