Ciao
Ho migrato una soluzione dal vs2003 a vs2010, adesso ho un errore che mi sembra di non aver mai capito niente di programmazione in tanti anni
Suppongo che sia un problema legato allo Public Shared Function ma non sono certo perche' non ho capito bene come funzioni
Ho questa classe/funzione in cui vado dentro col debug
Appena entro la variabile strSQL = Nothing
Eseguo SOLO la prima istruzione
strSQL = "uno"
e "magicamente" la stringa contiene invece...
"select distinct r.CCRP_COD_RAPPORTO COD, r.CCRP_COD_RAGGRUPP RAGGR, rp.CCRP_DESCRIZIONE DESCR, r.CCRP_DATA_RAPPORTO DATA_RAP, r.CCRP_NUM_PAG NPAGE, case when rp.CCRP_DETTAGLIO = 'S' then 1 else 0 end ISDETT from CCRP_REPORTS r, CCRP_REPORTS_PARAM rp, CCRP_RECIP_REPORTS rr, CCUR_UTENTI_RECIP ur where r.CCRP_COD_RAPPORTO = rp.CCRP_COD_RAPPORTO and r.CCRP_COD_RAGGRUPP = rp.CCRP_COD_RAGGRUPP and rr.ccrp_cod_rapporto = rp.ccrp_cod_rapporto and rr.ccrp_cod_raggrupp = rp.ccrp_cod_raggrupp and rr.CCRP_RECIPIENT = ur.CCUR_RECIPIENT and ur.CCUR_UTENTE like '' and r.CCRP_COD_RAPPORTO like '%' and r.CCRP_COD_RAGGRUPP like '%'"
Insomma come se avesse eseguioto anche la seconda istruzione... ma ho coumnque DUE errori incomprensibili
1)Perche' la stringa viene valorizzata ancora prima di eseguire la seconda istruzione?
2)E poi nella where c'e' and ur.CCUR_UTENTE like '' mentre la seconda istruzione dovrebbe valorizzarla con ur.CCUR_UTENTE like 'CO03298'
Questo e' il codice :
stranamente inoltre durante il debug il breakpoint illumina su piu' righe malgrado abbia messo tante righe vuote tra le due istruzioni (qui ne ho tolte un bel po)
Gia' provato a pulire la webcache, riavviare il PC, ricompilare…. Mi manca solo di andare a Lourdes
Grazie molte!!!!!
Imports sysLibrary
Public Class cReports
Public Shared Function GetReports(ByVal strDate1 As String, ByVal strDate2 As String, ByVal strCode As String, ByVal strRaggr As String, ByVal strUtente As String, ByVal IsDett As Boolean) As DataSet
Dim strSQL As String
strSQL = "uno"
strSQL = "select distinct r.CCRP_COD_RAPPORTO COD, r.CCRP_COD_RAGGRUPP RAGGR, rp.CCRP_DESCRIZIONE DESCR, " & _
"r.CCRP_DATA_RAPPORTO DATA_RAP, r.CCRP_NUM_PAG NPAGE, " & _
"case when rp.CCRP_DETTAGLIO = 'S' then 1 else 0 end ISDETT " & _
"from CCRP_REPORTS r, CCRP_REPORTS_PARAM rp, CCRP_RECIP_REPORTS rr, CCUR_UTENTI_RECIP ur " & _
"where r.CCRP_COD_RAPPORTO = rp.CCRP_COD_RAPPORTO " & _
"and r.CCRP_COD_RAGGRUPP = rp.CCRP_COD_RAGGRUPP " & _
"and rr.ccrp_cod_rapporto = rp.ccrp_cod_rapporto " & _
"and rr.ccrp_cod_raggrupp = rp.ccrp_cod_raggrupp " & _
"and rr.CCRP_RECIPIENT = ur.CCUR_RECIPIENT " & _
"and ur.CCUR_UTENTE like 'CO03298' " & _
"and r.CCRP_COD_RAPPORTO like '" & strCode & "' " & _
"and r.CCRP_COD_RAGGRUPP like '" & strRaggr & "'"
Modificato da roberto9911 il 20 giugno 2017 17.14 -