1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| Option Strict On
Imports System.Data.SqlClient
Public Module SQLDataAccess
Public Function GetReader(ByVal pRequeteSQL As String) As SqlDataReader
Dim vCommande As New SqlCommand(GetChaineSQL(pRequeteSQL), DirectCast(HttpContext.Current.Session("CONNECTION"), SqlConnection))
Return vCommande.ExecuteReader()
End Function
Public Function GetTable(ByVal pRequeteSQL As String) As Data.DataTable
Dim vDataTable As New Data.DataTable("TABLE")
Dim vDataAdapter As SqlDataAdapter
vDataAdapter = New SqlDataAdapter(GetChaineSQL(pRequeteSQL), DirectCast(HttpContext.Current.Session("CONNECTION"), SqlConnection))
vDataAdapter.Fill(vDataTable)
Return vDataTable
End Function
Public Function GetScalar(ByVal pRequeteSQL As String) As Integer
Dim vCmd As New SqlCommand(pRequeteSQL, DirectCast(HttpContext.Current.Session("CONNECTION"), SqlConnection))
Dim vRes As Integer
vRes = CInt(vCmd.ExecuteScalar())
vCmd.Dispose()
vCmd = Nothing
Return vRes
End Function
End Module |
Partager