Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error while trying to open record set

Status
Not open for further replies.

charlesAri

Programmer
Jul 26, 2018
1
GB
I am working with a legacy application that was written in vb 6. In the code there is an embedded sql query. I am trying to make a left join on another database. using the following select statement:

SQL = "select h.case_ref, t.t5_desc, h.narisno, h.valuation_ref, h.claimant, h.t5," & _
" h.claim_amount, h.claim_date , h.dateofentry, h.case_completed, l.project_short_name AS narisno_desc, h.case_type "
If blnFromCaseRefSelection = True Then
SQL = SQL & " from case_header h left join lut_t5 t on h.t5 = t.t5 left join" & _
" [production].[dbo].[xxx_01_project_attributes] l on h.nno = l.pin where h.case_ref = '" & cboCaseRef.Text & "'"
Else
SQL = SQL & " from lut_fileref f, case_header h left join lut_t5 t on h.t5 = t.t5" & _
" left join lut_nno n on h.nno = n.nno Where h.case_ref = f.case_ref" & _
" and f.ha_fileref = '" & xxoHAFileRef.Text & "'"
End If

error : The server principal (username) unable to access the database production under the current security context

Any idea of how ui can solve this, my experience with VB 6 is basic


 
That's really an error at the SQL Server end, and normally means that (username) does not have the relevant permissions against the database 'production'. This can sometimes be the result of a restore from backup causing some accounts to be orphaned, for example. You probaably need to engage your DBAs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top