Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie need SQL Server connection help!

Status
Not open for further replies.

davevail

Programmer
Mar 16, 2002
24
US
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
 
simplest way of getting your first connection string is by using the data environment your visual basic 6. select project - add data environment, right click on the connection1 and follows the wizard, after the connection is ok, copy the value in the connectionsource properties, there, u should have your first connection string ready.
 
Thanks, I did what u said - the value of ConnectionString is Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Security;Data Source=VWC1
do I replace the path in
OpenDatabase("\vb\dave\security.mdb")
with this then?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top