Hi,
I am required to insert some data into an access file using javaScript Though the code is inserting the values properly but i am getting an JS Error."
operation is not allowed when object is closed"
Here is the code
please suggest how should i close the rs?(you will know "rs" whenyou see the code)
<!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" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="generator" content="CoffeeCup HTML Editor (www.coffeecup.com)" />
<meta name="created" content="Wed, 19 Aug 2009 06:14:01 GMT" />
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<script language="JavaScript" >
function getSubmit()
{
var LastName = "Kanujia";
var Firstn = "Nitin" ;
var cn = new ActiveXObject("ADODB.Connection");
//here you must use forward slash to point strait
var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:/clientDB.mdb";
var rs = new ActiveXObject("ADODB.Recordset");
var SQL = "INSERT INTO Customers(FirstName, Surname)"
+ " VALUES ( '"+ Firstn +"', '" + LastName +"')";
cn.Open(strConn);
rs.Open(SQL, cn);
//surname.value = rs(0);
rs.Close();
cn.Close();
}
</script>
</head>
<body>
<input type="button" value="submit" onclick="getSubmit()">
</body>
</html>