Hi, I just installed SQL Server 2000 on my home computer for learning purposes - I converted some tables from an ACCESS database to a SQL database - my server is named "VWC1" and the SQL database is "Security" - I am trying to get a VB program that runs OK with Access to work on the SQL/Server database - I am having problems getting the proper "connection" code(struggling for hours..) - I will post the old ACCESS code here - any help appreciated in converting this for SQL/Server
Thanks to all responders!
----------------------------
Attribute VB_Name = "Module1"
Option Explicit
'declare DAO variables
Private db As Database
Private rs As Recordset
Public Function GoodCredentials(UserName As String, Password As String) As Boolean
'This function is exposed to the project and is used to check _
the user name and password passed from the Logon form. If the _
user name and password are found, the function returns True.
'Use DAO to create a recordset to search
Set db = OpenDatabase("\vb\dave\security.mdb"
Set rs = db.OpenRecordset("Users", dbOpenDynaset)
'Search the recordset object for the user name
rs.FindFirst "[userName] = '" & UserName & "'"
'If the user name is found and the password for that record _
matches the password given by the user, the credentials are _
good; if no user name is found or the password is not correct _
the credentials are bad.
If Not rs.NoMatch And rs![Password] = Password Then
GoodCredentials = True
Else
GoodCredentials = False
End If
End Function
Thanks to all responders!
----------------------------
Attribute VB_Name = "Module1"
Option Explicit
'declare DAO variables
Private db As Database
Private rs As Recordset
Public Function GoodCredentials(UserName As String, Password As String) As Boolean
'This function is exposed to the project and is used to check _
the user name and password passed from the Logon form. If the _
user name and password are found, the function returns True.
'Use DAO to create a recordset to search
Set db = OpenDatabase("\vb\dave\security.mdb"
Set rs = db.OpenRecordset("Users", dbOpenDynaset)
'Search the recordset object for the user name
rs.FindFirst "[userName] = '" & UserName & "'"
'If the user name is found and the password for that record _
matches the password given by the user, the credentials are _
good; if no user name is found or the password is not correct _
the credentials are bad.
If Not rs.NoMatch And rs![Password] = Password Then
GoodCredentials = True
Else
GoodCredentials = False
End If
End Function