Non capisco, il messaggio di errore è cambiato: in pratica non viene riconosciuta la tabella su cui faccio la query, ma questa tabella esiste e il percorso di connessione al db è corretto. Questo codice, inoltre funziona benissimo in un'altra applicazione analoga (ho fatto copia incolla modificandone tutti i riferimenti). Eccolo:
codice:procedure TForm1.btCercaRepertorioClick(Sender: TObject); var ImageFileName:string; begin if cmbComune.KeyValue<>null then if cmbRepertorio.KeyValue<>null then CercaRepertorio.DataSet.CommandText:='select * from Immagine where Immagine_comune = ' + intTostr(cmbComune.keyvalue) + ' and Immagine_repertorio = ' + inttostr(cmbRepertorio.keyvalue); if cmbComune.keyvalue<>Null then if cmbRepertorio.keyvalue=null then CercaRepertorio.DataSet.CommandText:='select * from Immagine where Immagine_comune = ' + inttostr(cmbComune.KeyValue); if cmbComune.keyvalue=null then if cmbRepertorio.keyvalue<>null then CercaRepertorio.dataset.commandText:='select * from Immagine where Immagine_Repertorio = ' + inttostr(cmbRepertorio.keyvalue); CercaRepertorio.Close; CercaRepertorio.Active:=true; CercaRepertorio.Open; dsCercaRepertorio.DataSet.Active:=true; begin ImageFileName:=CercaRepertorio.FieldByName('Immagine_Jpg').AsString; ImgRepertorio.Bitmap.LoadFromFile(ExtractFilePath(Application.exename)+ 'REPERTORI\'+ ImageFileName); end; end;![]()

Rispondi quotando