Welcome to Dream.In.Code
Become an Expert!

Join 150,222 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,217 people online right now. Registration is fast and FREE... Join Now!




ASP.net within JavaScript

 
Reply to this topicStart new topic

ASP.net within JavaScript

pabs1983
8 Dec, 2007 - 12:04 AM
Post #1

New D.I.C Head
*

Joined: 14 Dec, 2006
Posts: 30



Thanked: 1 times
My Contributions
Hi guys, i am looking for help. I have been trying to get this to work for about 2 days now, and i just cant get it right!!!. I currently have 2 JavaScript files, that are linked to from a script tag in an ASP Page. I am trying to connect to a sql database and using the data to populate the graph. The 2 javascript files work, they are not the problem.


Script:
CODE

<script type="text/javascript" src="graph.js"></script>
<script type="text/javascript" src="line.js"></script>
<div id="lineCanvas" style="overflow: auto; position:relative;height:600px;width:700px;">
</div>
<script type="text/javascript">

                var g = new line_graph();
                        <%
                            set conn=Server.CreateObject("ADODB.Connection")
                            conn.Open "TXTracker"

                            set rs = Server.CreateObject("ADODB.recordset")
                            rs.Open "SELECT Date, Time_Spent FROM TXTracker ORDER BY ID Desc", conn
                        %>

                
                        <% do until rs.EOF
                           for each x in rs.Fields %>
                            g.add('<% Response.Write(rs("Date")) & "','" & (rs("Time_Spent")) %>');
                            
                            <% next
                                rs.MoveNext %>
                                
                        <% loop
                            rs.close
                            conn.close
                        %>

                g.render("lineCanvas", "Line Graph");
</script>


For some reason, this is calling each line twice, for example,

CODE

g.add('17/11/2007','2.17');

g.add('17/11/2007','2.17');


These rows only appear once in the database. Where am i going wrong??? crazy.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 05:47AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month