G
Guest
Ok, I have the following code. Does any one know how I go about taking this
record set and trying to find if a record exits in it? - Thanks Dale
Imports System.Data.SqlClient
Public Module modLoadDefaults
Public gCONN As New SqlConnection
Public gbMakeConnection As Boolean
Public rsUsers As New Data.DataTable("Users")
Private Function MakeConnection() As SqlConnection
If gCONN.State <> ConnectionState.Open Then
With gCONN
.ConnectionString = "Integrated Security=TRUE;Initial
Catalog=SQL_Test;Data Source=SERVER\SQLtest "
End With
End If
gbMakeConnection = True
Return gCONN
End Function
Public Function GetUsers() As DataTable
Dim connection As SqlConnection = MakeConnection()
Dim da As New SqlDataAdapter("SELECT * FROM USERS", gCONN)
If gbMakeConnection Then
gCONN.Open()
da.Fill(rsUsers)
If connection.State <> ConnectionState.Closed Then
connection.Close()
Return rsUsers
End If
End Function
record set and trying to find if a record exits in it? - Thanks Dale
Imports System.Data.SqlClient
Public Module modLoadDefaults
Public gCONN As New SqlConnection
Public gbMakeConnection As Boolean
Public rsUsers As New Data.DataTable("Users")
Private Function MakeConnection() As SqlConnection
If gCONN.State <> ConnectionState.Open Then
With gCONN
.ConnectionString = "Integrated Security=TRUE;Initial
Catalog=SQL_Test;Data Source=SERVER\SQLtest "
End With
End If
gbMakeConnection = True
Return gCONN
End Function
Public Function GetUsers() As DataTable
Dim connection As SqlConnection = MakeConnection()
Dim da As New SqlDataAdapter("SELECT * FROM USERS", gCONN)
If gbMakeConnection Then
gCONN.Open()
da.Fill(rsUsers)
If connection.State <> ConnectionState.Closed Then
connection.Close()
Return rsUsers
End If
End Function