You must Sign In to post a response.
  • Category: .NET

    Fetch data from DB and store it in Array using Classic ASP

    Hi Friends,

    I have to get some details from DB and have to save all the data in array using Classic ASP.

    Ex, select NAME, START_DATE from table where ID >2112

    Here i have to store NAME in one Array variable and START_DATE in another Array.


    Any idea?

    Thanks in advance.
  • #765527

    Hi,
    Dim ArrayName()
    ReDim ArrayName(-1)
    Dim ArraySTDate()
    ReDim ArraySTDate(-1)
    For Each sqlValues In sqlResult
    ReDim Preserve ArrayName(UBound(ArrayName) + 1)
    ArrayName(UBound(ArrayName)) = sqlValues("NAME")
    ReDim Preserve ArraySTDate(UBound(ArraySTDate) + 1)
    ArraySTDate(UBound(ArraySTDate)) = sqlValues("START_DATE")
    Next
    Hope it helps.!

  • #765578
    Hi Shashi,

    I tried as bellow but am getting Type Mismatch ERROR. Any idea??

    Set rset = Conn.Execute("select NAME,START_DATE from table where ID >2112")

    Dim arrProducts
    arrProducts = rset .GetRows()


    Dim ArrayName()
    ReDim ArrayName(-1)
    Dim ArraySTDate()
    ReDim ArraySTDate(-1)
    For Each sqlValues In arrProducts
    ReDim Preserve ArrayName(UBound(ArrayName) + 1)
    ArrayName(UBound(ArrayName)) = sqlValues("NAME")
    ReDim Preserve ArraySTDate(UBound(ArraySTDate) + 1)
    ArraySTDate(UBound(ArraySTDate)) = sqlValues("START_DATE")
    Next

  • #765579
    Hi Shashi,

    Thanks a lot. Got it.

    Instead of FOE EACH i used the below line, and got it.

    For i = 0 to ubound(arrProducts, 2)


Sign In to post your comments