View Single Post
  #6 (permalink)  
Old Nov 21st, 2007, 06:49
mkhizess mkhizess is offline
New Member
Join Date: Nov 2007
Location: Cape Town
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: How to connect the microsoft access database using HTML page

Quote:
Originally Posted by robbied72 View Post
As alex said learn some ASP as you will need to know how to query the database, once you have done that then get a connection string from here.
<html>
<head>
<title>Entitled Document</title>
<script language="JavaScript" >

function getSubmit()
{
var LastName;
var Firstn = names.value ;

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 ( '"+ names.value +"', '" + surname.value +"')";
var SQL = "select Surname, DOB from Customers where FirstName = '" + Firstn + "'";

cn.Open(strConn);
rs.Open(SQL, cn);
surname.value = rs(0);
DOB.value = rs(1);
//alert(rs(0));
rs.Close();
cn.Close();


}

</script>
</head>
<body>

<input type="text" name="names" />
<input type="text" name="surname" />
<input type="text" name="DOB" />
<input type="button" value="submit" onclick="getSubmit()">

</body>
</html>
Reply With Quote