Click here to Skip to main content
15,917,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have written the code shown below bt getting error "activexobject is not defined".



XML
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="javascripconn.aspx.vb" Inherits="ProjectMidDayMeal.javascripconn" %>

<!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 runat="server">
    <title>Untitled Page</title>
    <script>
function getdata()
{
debugger;
var connection = new ActiveXObject("ADODB.Connection") ;

var connectionstring="Data Source=NODE5\SQLSERVER2005;Initial Catalog=MDM;User ID=sa;Password=admin123;Provider=SQLOLEDB";

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

rs.Open("SELECT * FROM BlockMaster", connection);
rs.MoveFirst
while(!rs.eof)
{
   document.write(rs.fields(1));
   rs.movenext;
}

rs.close;
connection.close;
}
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    </div>
    </form>

<input type="button" onclick="getdata()" value="get data" />
</body>

</html>


==========================================================================
pls. tell me where is the problem.
Posted
Comments
Sergey Alexandrovich Kryukov 17-May-13 2:06am    
Bad idea. ActiveX is evil, and JavaScript (client-side) is not a good choice for database connectivity. Only the server side technology.
—SA

1 solution

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900