TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sriram chv
NA
35
29.4k
How to get table from sql to htmltable using javascript
Jul 28 2011 4:39 AM
hi everybody,
i have taken a html page my task was i have taken a button and table in html page ,my task is "when clicked on button table in sqlserver must display in html table using javascript" (plz help me with code i tried a lot)
my code is follows:
function getsqltable() {
var connection = new ActiveXObject("ADODB.Connection");
var connectionstring = "Data Source=xxxxxx;Initial Catalog=xxxx;User ID=sa;Password=xxxx;Provider=SQLOLEDB";
connection.Open(connectionstring);
var rs = new ActiveXObject("ADODB.Recordset");
rs.Open("select * from sample", connection);
rs.MoveFirst
while (!rs.eof) {
var tdt = rs.fields(0);
var tdt2 = tdt + rs.fields(1);
table1.width = tdt2;
rs.movenext;
}
rs.close;
connection.close;
}
Collapse
</script>
</head>
<body>
<input id="Button1" önclick="getsqltable();" type="button" value="button" />
<table style="width:26%; height: 180px;">
<tr>
<td>
</td>
<td id="table1">
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</body>
</html>
Reply
Answers (
1
)
How to retrieve table from sql and display in html table
How use my c# method in to html page by javascript