Click here to Skip to main content
14,665,550 members
Rate this:
Please Sign up or sign in to vote.
See more:
hi everybody,
in have added an html page in 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" "">

<html xmlns="">
    <script type="text/javascript" language="javascript">

        function getsql() {

            var connection = new ActiveXObject("ADODB.Connection");

            var connectionstring = "Data Source=ajel-xxxxxx;Initial Catalog=xxxxx;User ID=sa;Password=xxxxx;Provider=xxxxx";

            var rs = new ActiveXObject("ADODB.Recordset");

            rs.Open("SELECT * FROM studenttable", connection);

            while (!rs.eof) {

    <style type="text/css">
            height: 40px;
            width: 108px;
            margin-bottom: 0px;

        <input id="Button1" type="button" value="button"  önclick="return Button1_onclick()" /></p>
        <textarea id="TextArea1" cols="20" name="S1" rows="1"></textarea></p>
Updated 24-Jul-11 23:03pm

Rate this:
Please Sign up or sign in to vote.

Solution 1


I think your code is not safe.
I sure that every one can see your js code. There you have you connection sting made public.
I can try populate the area from code behind and use js action set visible attribute of textarea component.
Rate this:
Please Sign up or sign in to vote.

Solution 2

Hi alex banu,
please give me the answer for my task iam a fresher

thanks and reguards,

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100