charlesAri
Programmer
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
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