Solved

How to  get result from TSQL to JavaSCript  using old classic ASP page ?

Posted on 2016-08-12
2
44 Views
Last Modified: 2016-09-23
We use classic ASP page
there is below vbscript code where :
1) invoiceResult  is VB Array
2)invoiceSql : stored proc on SQL server
3) ricoh  is company library which I cannot change ( no accsess)

 invoiceResult = ricoh.storedproc(invoiceSql
Question I need javascript array instead off vb6
Does not matter how I get it.
Can I transform somehow bv6 array to  javascript array?
Or  Can I use Ajax to get SQL data from classic ASP?
0
Comment
Question by:Yampolka
2 Comments
 
LVL 12

Accepted Solution

by:
funwithdotnet earned 500 total points
ID: 41755691
You can inject the results set directly into javascript. The VB runs before any javascript. You can use the VB array to populate data in any javascript script you like.

Something like ...
<%
dim delimiter = ""
dim jsString  = "var jsArray = ["
For each [item in VBArray]
 jsString &= delimiter & """" & [specific string item in VBArray] & """"
delimiter = ", "
Next
jsString  &= "];"
%>
<%=jsString%> <!-- Contains the completed javascript array declaration that can be injected in to any client-side script.-->

Open in new window

0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question