Click here to Skip to main content
15,896,730 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am totally new to programming, so please excuse if my question is too lame. I am working in Asp.net. I need my database values in source code of my form. i.e. javascript

What I have tried:

How to fetch data from sql database in javascript and draw line .
Posted
Comments
[no name] 22-Feb-16 23:42pm    
Do you want to use AJAX to fetch data from database?

Secondly we are not sure about to draw line, elaborate it more...
Member 12312733 23-Feb-16 5:32am    
I have already fetched data from database using ajax. But i am not sure, how can i use that fetched data to draw line. As in below, i want to use database data to make lines accordingly.

e.beginPath();
e.strokeStyle = "Black";
e.lineWidth = width;
e.moveTo(125, 125);
e.lineTo(X[i], Y[i]);
e.stroke();

[no name] 23-Feb-16 6:04am    
So you are drawing line, where is the problem? Follow below link:

http://www.w3schools.com/tags/canvas_lineto.asp
Member 12312733 23-Feb-16 8:08am    
I want user to input lets suppose his name, that name will be matched from the database, and then "distance" will be used as width of line.

(my database has 2 columns. Lets say name, distance)
[no name] 23-Feb-16 8:11am    
It is staright forward. As you are telling, you sent AJAX request to server and check the username then fetch distance.

Once you get the distance, you new to draw line using Canvas HTML5 object.
http://www.w3schools.com/tags/canvas_lineto.asp

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900