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 display sql table in textarea in html page when button clicked in javascript
Jul 25 2011 3:41 AM
Hi everybody,
"question and code follows":
In have added an html page in asp.net website now my task is ::
i have one button and textarea in design part of html page,i want to display sqlserver table data in textarea control when clicked on button using javascript.please tell me the procedure and javascript code to do this task
i have written some code please look at this code as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" language="javascript">
function getsql() {
var connection = new ActiveXObject("ADODB.Connection");
var connectionstring = "Data Source=ajel-f4086fb383;Initial Catalog=sriram;User ID=sa;Password=Ajel;Provider=SQLOLEDB";
connection.Open(connectionstring);
var rs = new ActiveXObject("ADODB.Recordset");
rs.Open("SELECT * FROM studenttable", connection);
rs.MoveFirst
while (!rs.eof) {
document.write(rs.fields(0));
document.write(rs.fields(1));
document.write(rs.fields(2));
rs.movenext;
}
rs.close;
connection.close;
}
</script>
<style type="text/css">
#TextArea1
{
height: 40px;
width: 108px;
margin-bottom: 0px;
}
</style>
</head>
<body>
<input id="Button1" type="button" value="button" önclick="return Button1_onclick()" />
<textarea id="TextArea1" cols="20" name="S1" rows="1"></textarea>
</body>
</html>
Reply
Answers (
6
)
Apply CSS on ASP controls
How to get textbox entered value and with related row value in textarea using xml file in javascript