PDA

View Full Version : Javascript + ASP + MS SQL = Confused Me



kevinmtu
10-21-2005, 04:41 PM
I have developed a javascript 'application' and have been using test data in it, it has come time to put a database behind it and I am having quite a bit more trouble than I intially imagined. I have spent a while trying to learn the difference between client-side and server-side, but still cannot bring it all together.

My situation seems to be pretty basic. I want to read row by row through a database using ASP.net (VB.net) and call a javascript function that will creave divs on a page based on this information. My problem is that I cannot figure out how to pass the database information into the function.... ideas?

mattster
10-24-2005, 08:23 AM
Probably best to use something like ASP.net Maker:

http://www.hkvstore.com/aspnetmaker/

does most of the hard work for you.

Twey
10-24-2005, 02:29 PM
I can't give you specifics, as I don't know ASP, but when you're using a server-side language and a client-side language together, you would need to echo the values into the script directly. For example, if the database info was stored in an array called RowOne, you could do:

<script type="text/javascript">
var RowOne = Array();
<%
For Each x In RowOne
Response.Write("RowOne[" & x & "] = " & RowOne(x) & ";")
Next
%>
</script>
My syntax is probably all wrong, but you get the idea.