编辑页面树状目录变更,待排查问题
This commit is contained in:
@@ -117,6 +117,22 @@ Namespace Database
|
||||
Return True
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 打开数据库连接
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public Async Function OpenAsync() As Task(Of Boolean)
|
||||
If _connection Is Nothing Then Return False
|
||||
If String.IsNullOrWhiteSpace(_connectionString) Then Return False
|
||||
Try
|
||||
_connection.ConnectionString = _connectionString
|
||||
Await _connection.OpenAsync()
|
||||
Catch ex As Exception
|
||||
Throw
|
||||
End Try
|
||||
Return True
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 关闭数据库连接
|
||||
''' </summary>
|
||||
@@ -152,6 +168,22 @@ Namespace Database
|
||||
Return result
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 运行非查询语句,返回执行该语句受到影响的行数
|
||||
''' </summary>
|
||||
''' <param name="commandText">执行的数据库命令文本</param>
|
||||
''' <returns></returns>
|
||||
Public Async Function ExecuteNonQueryAsync(commandText As String) As Task(Of Integer)
|
||||
Dim result As Integer
|
||||
Try
|
||||
_command.CommandText = commandText
|
||||
result = Await _command.ExecuteNonQueryAsync()
|
||||
Catch ex As Exception
|
||||
Throw
|
||||
End Try
|
||||
Return result
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 使用命令参数模式执行非查询语句,返回执行该语句受到影响的行数
|
||||
''' </summary>
|
||||
@@ -173,6 +205,28 @@ Namespace Database
|
||||
Return result
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 使用命令参数模式执行非查询语句,返回执行该语句受到影响的行数
|
||||
''' </summary>
|
||||
''' <param name="commandText">执行的数据库命令文本</param>
|
||||
''' <param name="commandParams">执行的数据库命令参数</param>
|
||||
''' <returns></returns>
|
||||
Public Async Function ExecuteNonQueryAsync(commandText As String, commandParams As DbParameterCollection) As Task(Of Integer)
|
||||
Dim result As Integer
|
||||
Try
|
||||
_command.CommandText = commandText
|
||||
_command.Parameters.Clear()
|
||||
For Each param As DbParameter In commandParams
|
||||
_command.Parameters.Add(param)
|
||||
Next
|
||||
result = Await _command.ExecuteNonQueryAsync()
|
||||
Catch ex As Exception
|
||||
Throw
|
||||
End Try
|
||||
Return result
|
||||
End Function
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' 执行数据库语句,返回数据库读取流的句柄
|
||||
''' </summary>
|
||||
@@ -189,6 +243,22 @@ Namespace Database
|
||||
Return result
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 执行数据库语句,返回数据库读取流的句柄
|
||||
''' </summary>
|
||||
''' <param name="commandText">执行的数据库命令文本</param>
|
||||
''' <returns></returns>
|
||||
Public Async Function ExecuteReaderAsync(commandText As String) As Task(Of DbDataReader)
|
||||
Dim result As DbDataReader
|
||||
Try
|
||||
_command.CommandText = commandText
|
||||
result = Await _command.ExecuteReaderAsync()
|
||||
Catch ex As Exception
|
||||
Throw
|
||||
End Try
|
||||
Return result
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 使用命令参数模式执行数据库语句,返回数据库读取流的句柄
|
||||
''' </summary>
|
||||
@@ -210,6 +280,27 @@ Namespace Database
|
||||
Return result
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 使用命令参数模式执行数据库语句,返回数据库读取流的句柄
|
||||
''' </summary>
|
||||
''' <param name="commandText">执行的数据库命令文本</param>
|
||||
''' <param name="commandParams">执行的数据库命令参数</param>
|
||||
''' <returns></returns>
|
||||
Public Async Function ExecuteReaderAsync(commandText As String, commandParams As DbParameterCollection) As Task(Of DbDataReader)
|
||||
Dim result As DbDataReader
|
||||
Try
|
||||
_command.CommandText = commandText
|
||||
_command.Parameters.Clear()
|
||||
For Each param As DbParameter In commandParams
|
||||
_command.Parameters.Add(param)
|
||||
Next
|
||||
result = Await _command.ExecuteReaderAsync()
|
||||
Catch ex As Exception
|
||||
Throw
|
||||
End Try
|
||||
Return result
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 执行数据库语句,返回查询结果的第一行第一列的内容
|
||||
''' </summary>
|
||||
@@ -226,6 +317,21 @@ Namespace Database
|
||||
Return result
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 执行数据库语句,返回查询结果的第一行第一列的内容
|
||||
''' </summary>
|
||||
''' <param name="commandText">执行的数据库命令文本</param>
|
||||
''' <returns></returns>
|
||||
Public Async Function ExecuteScalarAsync(commandText As String) As Task(Of Object)
|
||||
Dim result As Object
|
||||
Try
|
||||
_command.CommandText = commandText
|
||||
result = Await _command.ExecuteScalarAsync()
|
||||
Catch ex As Exception
|
||||
Throw
|
||||
End Try
|
||||
Return result
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 使用命令参数模式执行数据库语句,返回查询结果的第一行第一列的内容
|
||||
@@ -248,6 +354,26 @@ Namespace Database
|
||||
Return result
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 使用命令参数模式执行数据库语句,返回查询结果的第一行第一列的内容
|
||||
''' </summary>
|
||||
''' <param name="commandText">执行的数据库命令文本</param>
|
||||
''' <param name="commandParams">执行的数据库命令参数</param>
|
||||
''' <returns></returns>
|
||||
Public Async Function ExecuteScalarAsync(commandText As String, commandParams As DbParameterCollection) As Task(Of Object)
|
||||
Dim result As Object
|
||||
Try
|
||||
_command.CommandText = commandText
|
||||
_command.Parameters.Clear()
|
||||
For Each param As DbParameter In commandParams
|
||||
_command.Parameters.Add(param)
|
||||
Next
|
||||
result = Await _command.ExecuteScalarAsync()
|
||||
Catch ex As Exception
|
||||
Throw
|
||||
End Try
|
||||
Return result
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 执行数据库语句,返回执行结果返回的数据表,常用于查询命令
|
||||
@@ -272,6 +398,7 @@ Namespace Database
|
||||
Return dataTable
|
||||
End Function
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' 执行数据库语句,返回执行结果返回的数据表,常用于查询命令
|
||||
''' </summary>
|
||||
|
||||
Reference in New Issue
Block a user