Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 143529

SQL SERVER 916 ERROR

$
0
0

Hi

I have been trying to resolve an issue where on accessing a customized Purchase Order maintenance screen I am getting a SQL SERVER 916 error message which states:  " The server principal domain\administrator is not able to access the database XXXXXX under the current security context".

A Sql Profile trace was done and it is pointing to part in the code where the table UserRec from the system database is being reference. I viewed other sites that reference this issue but none of the suggestions so far was able to assist.  Has anyone here encountered this issue before and is willing to share how to fix it?   I will be very much appreciative.  Thanks in advance.

The code that I have on the screen that the trace is pointing to is as follows:

bxUserRec.UserInPOApprovalGroup = False

 SqlStr = "SELECT UserID, UserName,WindowsUserAcct,emailaddress,CustomGroup,User3,User4 "

SqlStr = SqlStr + " FROM  [PurSys].[dbo].[UserRec] "

SqlStr = SqlStr + "  WHERE rtrim(ltrim(UserID)) = '" + P_UserID + "'"

 serr1 = SqlFetch1(c1, SqlStr, bxUserRec, LenB(bxUserRec))

 If serr1 = NOTFOUND Then 'Initialize object

   bxUserRec.UserID = ""

   bxUserRec.UserName = ""

   bxUserRec.WindowsUserAccount = ""

   bxUserRec.emailaddress = ""

   bxUserRec.CustomGroup = ""

   bxUserRec.User3 = 0

   bxUserRec.User4 = 0

   bxUserRec.UserInPOApprovalGroup = False

Else ' Record Found

   If Trim(bxUserRec.CustomGroup) <> xPoAppr_glbPOApprovalGroup Then

      bxUserRec.UserInPOApprovalGroup = False

   Else

      bxUserRec.UserInPOApprovalGroup = True

   End If

End If

 Call SqlFree(c1)

 End Sub


Viewing all articles
Browse latest Browse all 143529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>