Click to See Complete Forum and Search --> : converting asp recordset values to javascript variables


jammydodger
10-15-2003, 09:59 AM
i am relatively new to javascript but fairly proficient in writing in asp. please would someone tell me whether it is possible to take values from a recordset written in asp and convert them to javascript values - and if so how to do it.
I would also be grateful if anyone could point me to any articles on how to write database connection strings in javascript.
help would be appreciated.

Khalid Ali
10-15-2003, 10:44 AM
something along these line may work

<%
while ....
%>
//js variable
var uerName = <% recordset.Fields("fieldName")%>;
<%
...
wend
%>

jammydodger
10-15-2003, 02:42 PM
Khalid, thanks for the idea, but it doesn't work no matter how i try it. i have used the following code:

<script language="JavaScript">
<!--
//js variable
var uerName = <%rsTender.Fields("address_1")%>;
document.form1.address_1r.value=uerName;
//-->
</script>
which should put the address_1 field value into the address_1r textbox, but it doesn't go. any other ideas?

jammydodger
10-15-2003, 03:06 PM
Khalid, i tried putting quotation marks around asp recordset field name, and it worked. thanks very much for the initial idea.

<script language="JavaScript">
<!--
//js variable
var uerName = "<%=recordset.Fields("field_1")%>"
document.form1.address_1r.value=uerName;
//-->
</script>

Khalid Ali
10-16-2003, 12:00 AM
you are welcome...:)