Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    [VB6] Array in un Select di SQL

    Che voi sappiate si può creare un recordset tramite una istruzione SELECT dove le condizioni WHERE sono date da un array()?
    Per esempio:
    codice:
    SELECT * FROM Tabella WHERE Matricola in array(1 to quantità)
    Grazie in anticipo per l'aiuto.
    Buona giornata.
    A Lucca si mangia,si beve e si cucca.

  2. #2
    codice:
    sql = "SELECT * FROM Tabella "
    
    if ubound(array)>0 then
    	sql = sql "WHERE Matricola IN ("
    	
    	for i=0 to ubound(array)
    		sql_where = sql_where & ", " & array(i)
    	next i
    	
    	sql_where = right(sql_where, len(sql_where) - 2)
    	sql_where = sql_where & " )" 
    	
    	sql = sql & sql_where & " )" 	
    end if
    prude il dito, lui sdraiato
    ha giocato a guardie e ladri col ladro sbagliato

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.