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.5k
To retrieve sql table and display in html table control
Jul 26 2011 4:40 AM
task: i have taken a button and table control in html page now my problem is to display sql table in html table control ....
please help me iam a fresher
my code as follows:
.....................................................................................
Collapse
<script type="text/javascript" language="javascript">
function getsqltable() {
var connection = new ActiveXObject("ADODB.Connection");
var connectionstring = "Data Source=;Initial Catalog=;User ID=sa;Password=;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;
}
</script>
</head>
<body>
<input id="Button1" onclick="getsql();" type="button" value="button" />
<table style="width: 100%;">
<tr>
<td id="table1">
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td id="table1">
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</body>
</html>
Improve question Permalink |
Posted 50 mins ago
sriram from Hyderabad383
Reply
Answers (
2
)
How to get textbox entered value and with related row value in textarea using xml file in javascript
How to retrieve table from sql and display in html table