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.
| Author |
Topic |
|
michaelxvo
Starting Member
47 Posts |
Posted - 2006-03-31 : 00:27:39
|
| I am sorry that this is a little off SQL Server topics.I understand Application Role from SQL Server is more secured than Standard Role.But from Visual Basic, How do I connect to SQL Server using Application Role. Please give me some VB codes in order for SQL Server to recognize I am refering to Application RoleThank you |
|
|
michaelxvo
Starting Member
47 Posts |
Posted - 2006-03-31 : 00:34:46
|
| I found the answer from here:http://support.microsoft.com/?kbid=308312On Error GoTo EH 'This avoids a message that no records were returned.DoCmd.SetWarnings FalseDim TSQLTSQL = "EXEC sp_setapprole 'AppRoleName', {Encrypt N 'Password'}, 'odbc'" 'This sets the app role on Connection #2.Application.CurrentProject.Connection.Execute TSQL 'This sets the app role on Connection #3.lst_approle.RowSource = TSQLlst_approle.RequeryDoCmd.SetWarnings TrueMsgBox "The application Role is now in effect.", vbInformationExit SubEH:MsgBox Err.Number & ": " & Err.Description, vbCritical |
 |
|
|
|
|
|