| | |
how to connect ms access database to html webpage
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
You need to use a server side programming language like ASP to do this. HTML cannot access a database itself.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
•
•
Join Date: Nov 2007
Posts: 2
Reputation:
Solved Threads: 0
<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>
<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>
•
•
Join Date: Sep 2005
Posts: 4
Reputation:
Solved Threads: 0
You have to save the file with .asp extension for the IIS server to interpret it correctly. Also it would be helpful if you post the output you are currently getting, as most probably you giving incorrect path for your access file.
[inline] as far as my knowledge goes u can't achieve this by javascript as well, try doin something like this [/inline]
[inline] save this as .jsp and add some code for displayin gthe fields. hope this will help u [/inline]
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<html> <%@ page import="java.sql.*"%> <% 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(); } catch(Exception e) { out.println("error occured:" + e.getMessage()); } %> </body> </html>
•
•
Join Date: Apr 2009
Posts: 1
Reputation:
Solved Threads: 0
You are able to connect to Microsoft Access using JavaScript when the HTML file is run locally and the Access .mdb file is accessible to the file system it does not work remotely due to the obvious security issues.
I had a situation where this functionality was actually useful, so I wrote a JavaScript library to simplify the process. This library allows you to execute SQL queries in a single command with the option of selecting the output format of the result-set from choices including JSON, XML, and HTML.
I had a great deal of difficulty finding information or examples of how to connect to Access, so I decided to share my code with the world...
The library is called ACCESSdb and you can get it here!
:thumbs:
I had a situation where this functionality was actually useful, so I wrote a JavaScript library to simplify the process. This library allows you to execute SQL queries in a single command with the option of selecting the output format of the result-set from choices including JSON, XML, and HTML.
I had a great deal of difficulty finding information or examples of how to connect to Access, so I decided to share my code with the world...
The library is called ACCESSdb and you can get it here!
:thumbs:
•
•
Join Date: Oct 2009
Posts: 1
Reputation:
Solved Threads: 0
1
#10 24 Days Ago
Hi,
I am creating something similar as discussed above.
I have a access database which has the list of banking centers and their hours of operation ,Monday -Sunday.
Now, i have created a html page, asking the user to select the state from a drop down menu, and the day as checkbox. So that when I click on "Submit Query' button, it gives me all the banking centers of that state open on Monday and at which time.
I want to link this HTML.html file with my access table.
Also, i want to have a out put screen in html/access form which shows the result.
Appreciate, what all you can make available.
Thanks
I am creating something similar as discussed above.
I have a access database which has the list of banking centers and their hours of operation ,Monday -Sunday.
Now, i have created a html page, asking the user to select the state from a drop down menu, and the day as checkbox. So that when I click on "Submit Query' button, it gives me all the banking centers of that state open on Monday and at which time.
I want to link this HTML.html file with my access table.
Also, i want to have a out put screen in html/access form which shows the result.
Appreciate, what all you can make available.
Thanks
![]() |
Similar Threads
- VB: Connect to Access database via ODBC datasource name (Visual Basic 4 / 5 / 6)
- Writing to an Access Database (Visual Basic 4 / 5 / 6)
- how to connect access with vb.net (VB.NET)
- access database search and display (Visual Basic 4 / 5 / 6)
- Accessing an Access Database using Java (Java)
- Create an Access Database using Java (Java)
- connect with access (Visual Basic 4 / 5 / 6)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: scrolling issue
- Next Thread: Help please with JavaScript
| Thread Tools | Search this Thread |
ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate array automatically browser bug calendar captchaformproblem cart checkbox child close codes createrange() cursor date debugger dependent disablefirebug dom dropdown editor element embed engine events explorer ext file firefox focus form forms frameworks getselection google gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe images internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jsp jump libcurl maps masterpage math media microsoft object onmouseoutdivproblem onreadystatechange parent paypal pdf php player position post programming progressbar prototype redirect regex runtime safari scale scriptlets scroll search security shopping size software sql text textarea unicode web website windowsxp wysiwyg \n






