Kundan  Jha

Kundan Jha

  • 764
  • 1.1k
  • 323.1k

JavaScripts function is not working ?

Oct 12 2015 8:42 AM
<script type="text/javascript">
function save() {
var name = document.getElementById("txt_Name").value;
var salary= document.getElementById("txt_salary").value;
var Objconnection = new ActiveXObject("ADODB.Connection");
var connectionstring = "Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Kundan\Documents\Visual Studio 2013\DataBase\MyDatabase.mdf;Integrated Security=True"";
Objconnection.Open(connectionstring);
var rs = new ActiveXObject("ADODB.Recordset");
var query = "insert into employees values('"+name+"','"+salary+"')";
rs.Execute(query,Objconnection);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
Name :
<input type="text" id="txt_Name" /><br />
Password:
<input type="text" id="txt_salary" /><br />
<button id="btnsave" value="SaveusingJvaScripts" name="SaveusingJvaScripts" onclick="save()">SaveusingJvaScripts</button>
</div>
</form>
</body>

Answers (4)