Hi group, I’m trying to associate two tables with common ID, and take the fields from both tables. I tried this code, but it’s very very slow… how can I improve it? I need to display all the fields of the two tables based on the ID.
rows2 = db.SelectSQL("SELECT * from IntestazioneFatturaAcquisti INNER JOIN NominativiDitte ON NominativiDitte.ID=IntestazioneFatturaAcquisti.ID_Nominativo")
While Not Rows2.AfterLastRow
rows = db.SelectSQL("SELECT * FROM CorpoFatturaAcquisti Where ID_Nominativo="+rows2.column("ID_Nominativo").StringValue+" and Materiale_Spedito like '%" +Campo1 +"%' and Materiale_Spedito like '%" +Campo2 +"%' order by Materiale_Spedito")
While Not Rows.AfterLastRow
ListBoxRicerca.AddRow(rows2.Column("ID_Nominativo").StringValue,rows2.Column("NomeDitta").StringValue.ConvertEncoding(Encodings.WindowsANSI),ConvertDateSQLToItalian(rows2.Column("Data").StringValue).ShortDate,rows2.Column("NumeroFattura").StringValue, rows.Column("Materiale_Spedito").StringValue.ConvertEncoding(Encodings.WindowsANSI))
rows.MoveToNextRow
wend
rows2.MoveToNextRow
Wend
3 posts - 3 participants