Support for ODBC

This commit is contained in:
Jonathan Jenne
2019-08-06 15:56:30 +02:00
parent cd5f982b46
commit f418074011
4 changed files with 194 additions and 6 deletions

View File

@@ -79,6 +79,11 @@ Public Class MSSQLServer
''' <returns>Returns true if properly executed, else false</returns>
''' <remarks></remarks>
Public Function NewExecutenonQuery(executeStatement As String, Optional Timeout As Integer = 120) As Boolean
_Logger.Warn("NewExecutenonQuery is deprecated. Use ExecuteNonQuery instead.")
Return ExecuteNonQuery(executeStatement, Timeout)
End Function
Public Function ExecuteNonQuery(SQLCommand As String, Optional Timeout As Integer = 120) As Boolean
Try
If TestCanConnect() = False Then
Return Nothing
@@ -86,7 +91,7 @@ Public Class MSSQLServer
Using oConnection = GetSQLConnection()
Using oSQLCOmmand = oConnection.CreateCommand()
oSQLCOmmand.CommandText = executeStatement
oSQLCOmmand.CommandText = SQLCommand
oSQLCOmmand.CommandTimeout = Timeout
oSQLCOmmand.ExecuteNonQuery()
Return True
@@ -94,7 +99,7 @@ Public Class MSSQLServer
End Using
Catch ex As Exception
_Logger.Error(ex)
_Logger.Debug("executeStatement: " & executeStatement)
_Logger.Debug("executeStatement: " & SQLCommand)
Return False
End Try
End Function
@@ -107,6 +112,11 @@ Public Class MSSQLServer
''' <returns>Returns true if properly executed, else false</returns>
''' <remarks></remarks>
Public Function NewExecuteScalar(ScalarSQL As String, Optional Timeout As Integer = 120) As Object
_Logger.Warn("NewExecuteScalar is deprecated. Use GetScalarValue instead.")
Return GetScalarValue(ScalarSQL, Timeout)
End Function
Public Function GetScalarValue(SQLQuery As String, Optional Timeout As Integer = 120) As Object
Try
If TestCanConnect() = False Then
Return Nothing
@@ -114,7 +124,7 @@ Public Class MSSQLServer
Using oConnection As SqlConnection = GetSQLConnection()
Using oSQLCOmmand = oConnection.CreateCommand()
oSQLCOmmand.CommandText = ScalarSQL
oSQLCOmmand.CommandText = SQLQuery
oSQLCOmmand.CommandTimeout = Timeout
Dim oResult As Object = oSQLCOmmand.ExecuteScalar()
Return oResult
@@ -122,7 +132,6 @@ Public Class MSSQLServer
End Using
Catch ex As Exception
_Logger.Error(ex)
_Logger.Debug("executeStatement: " & ScalarSQL)
Return Nothing
End Try
End Function