📄 classes.vb
字号:
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports Nozama.General
Namespace Nozama.DataAccess
Public Class Classes
Implements IDisposable
Private dsCommand As SqlDataAdapter
Public Sub New()
MyBase.New()
dsCommand = New SqlDataAdapter()
dsCommand.SelectCommand = New SqlCommand()
dsCommand.SelectCommand.Connection = New SqlConnection(Settings.ConnectionString)
dsCommand.TableMappings.Add("Table", ClassData.CLASSES_TABLE)
End Sub
Public Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
GC.SuppressFinalize(True)
End Sub
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If Not disposing Then
Exit Sub
End If
If Not dsCommand Is Nothing Then
If Not dsCommand.SelectCommand Is Nothing Then
If Not dsCommand.SelectCommand.Connection Is Nothing Then
dsCommand.SelectCommand.Connection.Dispose()
End If
dsCommand.SelectCommand.Dispose()
End If
dsCommand.Dispose()
dsCommand = Nothing
End If
End Sub
Public Function GetClasses() As ClassData
Dim data As ClassData
data = New ClassData()
With dsCommand
Try
With .SelectCommand
.CommandType = CommandType.Text
.CommandText = "SELECT * FROM Classes"
End With
.Fill(data)
Finally
If Not .SelectCommand Is Nothing Then
If Not .SelectCommand.Connection Is Nothing Then
.SelectCommand.Connection.Dispose()
End If
.SelectCommand.Dispose()
End If
.Dispose()
End Try
End With
Return data
End Function
End Class
End Namespace
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -