Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Populating a javascript array from SQL database

Author  Topic 

atc12345
Starting Member

2 Posts

Posted - 2008-04-02 : 15:08:39
Can anyone help with the proper syntax to use to populate a JavaScript array using values from an SQL database.
I tried doing the following with no results:

Dim sql,Rs1

sql = ""
sql = sql & "SELECT EmpNumber FROM EmpFile "
Set Rs1 = Server.CreateObject("ADODB.Recordset")
Rs1.Open sql, DecryptedText(TheFile,"ConSQL"), 3
%>

<script language="JavaScript">
EmpNumber=new Array(<%=Rs1("EmpNumber")%>);
</script>

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-04-04 : 13:44:19
Is the issue that you can't get a value into (<%=Rs1("EmpNumber")%> OR that you are getting a value but somehow it's not appearing on your client side?

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page
   

- Advertisement -