GOMES Posted May 25, 2009 at 07:11 PM Report #267211 Posted May 25, 2009 at 07:11 PM Boa tarde a todos . Gostaria se saber como posso interagir uma consulta entre os valores de um arraylist e uma tabela. Por exemplo While dr1.Read() ar_disc_target.Add(dr1(0)) End While Loop While dr1.NextResult() Aqui preencho a tabela depois nao consigo fazer este select myCommand = New SqlCommand("Select disc_id from disc_target where disc_id in " ar_disc_target", Connection) mas no array tinha de ser todos os valores do contidos por exemplo 40001,40002 e nao linha a linha como esta . Cumprimentos, DG
Weasel Posted May 26, 2009 at 07:12 AM Report #267262 Posted May 26, 2009 at 07:12 AM Vou ser sincero, não percebi o que queres... Knowledge to the masses
GOMES Posted May 26, 2009 at 07:21 AM Author Report #267263 Posted May 26, 2009 at 07:21 AM Bom dia a todos Já resolvi o problema era simples tinha de transformar um arraylist para stringbuilder ou seja o que eu pretendia era extrair os dados do arraylist para inserir na minha consulta de sql mas com o array tenha de verificar 1 a 1 isso já não dava pois tipo select * from table where id not in (arraylis.item(i)). solução: Dim resultado As New StringBuilder For i As Integer = 1 To ar_disc_target.Count - 1 --arraylist resultado.Append(ar_disc_target.Item(i).ToString) resultado.Append(",") Next resultado.Remove(resultado.Length - 1, 1) --tira o ultimo caracter e assim já tenho os valores todos para o select e comparar. Cumprimentos DG
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now