sriram chv

sriram chv

  • NA
  • 35
  • 29.6k

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


Answers (2)