none
Query database using array(i) RRS feed

  • Question

  • Hi, I have two single dimensional arrays.

    total = 3
    
    Dim test1()
    
    redim test1(total)
    
    .. 
    
    .. 
    
    Dim test2() 
    
    redim test2(total)
    
    .... 
    
    ... 
    

    After assigning values to both arrays, I have the below values in both arrays:

    test1 = A,B,C,D

    test2 = 1,2,3,4 '''

    Now I am trying to query the mysql database as below:

    select * from e1 where A = 1 AND B = 2 AND C = 3 AND D = 4 

    How can I write the query here using the values from test1 and test2 array? Note that value of total may change in different run time. Can you please help me fixing the below code? Do I need for loop? I have spent lot of time but I am lost. Thanks.

    Select * from e1 where test1(0) = test2(0) AND test1(1) = test2(1) AND test1(2) = test2(2) AND test1(3) = test2(3)

    Friday, February 6, 2015 4:53 PM

Answers