Return Query result to a variable - Classic Asp

Asked

Viewed 215 times

0

It is possible to return the result of a query to a variable in the classic Asp?

example:

<%
    dim retorno as string
    set minha_conexao = dao.open()
    set rs = minha_conexao.execute("Select max(data) from minha_tabela")
%>

At this point the query return will only be a value, as I do to assign this information to a variable.

I tried to make the set return = rs(0), however it is not returning.

  • He even tried the rs.fields(0)?

  • also brings no return

  • @Lepy Tried rs("Nomedacoluna") ?

1 answer

1


I suggest we do so:

set rs = minha_conexao.execute("Select max(data) as max_data from minha_tabela")
retorno = rs("max_data")

So you put in the return variable the value of the recordset that the query returns. Did you understand? Abs! LC

Browser other questions tagged

You are not signed in. Login or sign up in order to post.