0

I have set an application role for a database in SQL Server, so that other than my application nothing can access that database. But the problem is when I am trying to open two record-sets in same method, it throws an error that permission is not there for the second statement.

Example code :

Dim rs As ADODB.Recordset

Set rs = New ADODB.Recordset

Dim rs2 As ADODB.Recordset

Set rs2 = New ADODB.Recordset

rs.Open "Select * from Table1", Connection

rs2.Open "Select * from Table2", Connection

rs.Close

rs2.Close

When it is executing the second query, throws an error:

"The SELECT permission was denied on the object 'Table2', database 'Dat1', schema 'dbo'. (Error Number -2147217911)"

shA.t
  • 16,580
  • 5
  • 54
  • 111

0 Answers0