i need help how to login from VB into sql server using sql server account
how to login from VB into sql server
Collapse
X
-
Tags: None
-
1. In VB go to Project – References and check Microsoft ActiveX Data Object 2.1 Library.
2. I made it as simple as possible. Copy following script into any form and hit F5.
[PHP]Option Explicit
Public gConn As New Connection
Private Sub Form_Load()
Dim rRes As New ADODB.Recordset
gConn.Open "Provider=SQLOL EDB;database=db name;server=ser vername;uid=use rname;pwd=xxxxx "
Set rRes = gConn.Execute(" Select * from sysobjects order by name")
Me.Show
Do While Not rRes.EOF
Print rRes(0)
rRes.MoveNext
Loop
End Sub[/PHP]
Good Luck. -
You can also create a system DSN and connect through that in VB.Originally posted by adnan amini need help how to login from VB into sql server using sql server accountComment
-
friend which code u sent me.Originally posted by iburyakDon't forget to change database, server, uid and pwd to yours.
i hav done this already...but now i want to create a admin user and employee user of the single database...if admin enter his username and pw so he will hav all rights and if employee enter his identification so limited record will b displayed ,,,,so my question is that...how i create two accounts and from vb how to enter themComment
-
In connect string you have UID and PWD so you will know who requesting records on the server.
Create two different accounts and with different rights using Enterprise Manager.
You can create restricted view that would be granted to users with restricted rights and revoke all rights directly to tables.
You can use suser_sname() function on server side to check on user name that currently logged in.
Good luck.Comment
-
Comment