Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Connectivity

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-12-20 : 09:19:23
Jerome writes "How do I connect VB with Sql server without using username and
password and also without using Windows NT Authentication."

royv
Constraint Violating Yak Guru

455 Posts

Posted - 2001-12-20 : 09:25:03
You can configure a DSN entry one-time to point to the correct server, and then in your VB code, all you have to do is specify the provider and the dsn name and you are set.

*************************
Just trying to get things done
Go to Top of Page

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2001-12-20 : 10:37:47
The potential problem with this is that you may have to hard code a username and pswd in the connection string. If this isn't a problem then why not create a class module similar to this.....

Private cnn1 As Connection

Private msDSN As String
Private msUserID As String
Private msPassword As String

Public Property Let DSN(thisDSN As String)
msDSN = thisDSN
End Property

Public Property Get DSN() As String
DSN = msDSN
End Property

Public Property Let UserID(thisUserID As String)
msUserID = thisUserID
End Property

Public Property Get UserID() As String
UserID = msUserID
End Property

Public Property Let Password(thisPassword As String)
msPassword = thisPassword
End Property

Public Property Get Password() As String
Password = msPassword
End Property

Public Sub connect()

Set cnn1 = New Connection
cnn1.ConnectionString = "Data Source=" & msDSN & ";user ID=" & msUserID & ";password=" & msPassword
cnn1.Open

End Sub

Go to Top of Page
   

- Advertisement -