[thelist] ASP & Access - Using the same variable twice

Warden, Matt mwarden at mattwarden.com
Sat Nov 24 22:55:22 CST 2001


On Nov 25, Christian Anderson had something to say about [thelist] ASP &...

...
><%
>number = request.querystring("number")
>SQL=("SELECT * FROM t_kawaguchiko WHERE aID = " & number & ";")
>set conn = server.createobject("ADODB.Connection")
>conn.open "photobase"
>set store=conn.execute(SQL)
>%>
>
>So then I have some variable that I can call with <%= store(1) %> etc...  so
>if I have
>
>My name is: <%= store(1) %>
>I am whatever years old, bla bla bla bla bla, etc etc
>on and on and on
>
>...dont forget to email me, and dont forget that my name is <%= store(1) %>
>!
>
>So anyway, I call that <%= store(1) %> thing 2 times, and the second time I
>call it, nothing shows up.

Have you closed the recordset?
Have you called moveNext() or used the recordset in a for each loop?

>What can I do so it will allow me to use the same stuff more than once?

Whatever your problem is, all you have to do is store the resultset value
into a variant:

...
conn.open "photobase"
set store = conn.execute(SQL)
strName = store(1)

Response.Write "My name is:" & strName
...
Response.Write "... forget that my name is" & strName


hope this helps. if you want to know exactly what you did wrong, post more
of your script and i or someone else will help you out so you don't make
the same mistake next time.


--
mattwarden
mattwarden.com





More information about the thelist mailing list