|
-
Sep 25th, 2000, 04:18 PM
#1
Thread Starter
Hyperactive Member
I am trying to create an application that uses the SQL users and password logins and validate them in VB so that I can enable and disable various commands/buttons and also give out a message box if the username or password entered by the user is invalid. Is there a way I can authenticate the username and password in the application without using a stored procedure. I hope this request is not confusing.
This is what I have so far:
cn.Open "PROVIDER=MSDASQL;dsn=QCManager;uid=" & txtuName.Text & ";pwd=" & txtPword.Text & ";database=QCManager;"
-
Sep 25th, 2000, 04:44 PM
#2
If you want to get user names from the database, first you have to have appropriate rights to do that.
The easiest way to do it is to open a connection based on the login that the user specifies. Also, add On Error GoTo or On Error Resume Next statement to check if the connection was successful. If YES then user has valid login and password - otherwise NO.
-
Sep 25th, 2000, 04:54 PM
#3
Fanatic Member
At what point
If I understand correctly...
You want to do that at LOGIN time
Let the system help you
a. Use this function
'Example of the call to the function
'Get a connection and if not succesful bye...
If GetNewConnection(m_objConn) <> adStateOpen Then
Unload Me
Exit Sub
End If
'This function will pop up the Microsoft prompt
'and checks will be made for you as to user is
'valid or not...
Public Function GetNewConnection(ByRef ArgConnObj As ADODB.Connection) As Integer
On Error GoTo GetNewConnection_Error
Set ArgConnObj = New ADODB.Connection
With ArgConnObj
.Provider = "sqloledb"
.Properties("prompt") = adPromptComplete
.Open
GetNewConnection = .State
End With
Exit Function
Let me know....
-
Sep 27th, 2000, 08:08 AM
#4
Thread Starter
Hyperactive Member
Thank you, but need more help!
Thank you for your previous assistance, but I need more help. I used the on error goto line and it did work but now I need to find a way for VB to check the rights of the logged in user so that I can enable some commands. for example, if the user has admin rights, I would like to enable all buttons/commands. Any suggestions?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|