1,105,263 Community Members

how to connect ms access database to html webpage

Member Avatar
bapu435
Newbie Poster
9 posts since Jul 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
-4
 

i am developing a website in html in which the contactus page i have to connect to ms access database i am not able to get it ,can any one tell me how to get that one.

Member Avatar
stymiee
He's No Good To Me Dead
1,539 posts since May 2006
Reputation Points: 111 [?]
Q&As Helped to Solve: 48 [?]
Skill Endorsements: 8 [?]
Team Colleague
 
0
 

You need to use a server side programming language like ASP to do this. HTML cannot access a database itself.

Member Avatar
mkhizess
Newbie Poster
2 posts since Nov 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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>

Member Avatar
hidash_in
Junior Poster in Training
85 posts since Oct 2007
Reputation Points: -9 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
1
 

hello i cant get output for the above coding pls help.

Member Avatar
Shobhit
Newbie Poster
7 posts since Sep 2005
Reputation Points: -3 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

hello i cant get output for the above coding pls help.

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.

Member Avatar
techna
Newbie Poster
10 posts since Nov 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

[inline] as far as my knowledge goes u can't achieve this by javascript as well, try doin something like this [/inline]

<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>

[inline] save this as .jsp and add some code for displayin gthe fields. hope this will help u [/inline]

Member Avatar
kapil.soni
Newbie Poster
1 post since May 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
-1
 

Hi,
any one can help me out i have a excel database and want to show records in a html application; like i have employee code and their quality scores how i can show it in html form by putting emp code.

Member Avatar
MidiMagic
Nearly a Senior Poster
3,404 posts since Jan 2007
Reputation Points: 556 [?]
Q&As Helped to Solve: 215 [?]
Skill Endorsements: 2 [?]
 
0
 

Use the "Save as web page" option in the File menu.

Notice that html can't access a spreadsheet on your computer. You have to upload the changed web page after any changes to the spreadsheet.

Member Avatar
faulkj
Newbie Poster
3 posts since Apr 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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:

Member Avatar
goaway
Newbie Poster
2 posts since Oct 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
navinsharma
Newbie Poster
2 posts since Nov 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

plz if u get solution plz forward me too becoz i m also have same prob

Member Avatar
navinsharma
Newbie Poster
2 posts since Nov 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

plz if u get solution plz forward me too becoz i m also have same prob
at <snip>

Member Avatar
Troy III
Practically a Posting Shark
891 posts since Jun 2008
Reputation Points: 174 [?]
Q&As Helped to Solve: 119 [?]
Skill Endorsements: 10 [?]
 
0
 

If you are targeting Explorer only
you can always use a super lightwieght DSO to access data
go to MSDN and search for "Data Source Object" you'll find all that you need.

Member Avatar
sanjeev.vermas
Newbie Poster
1 post since Nov 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

plz if u get solution plz forward me too becoz i m also have same prob

hi...
now it will work
The given example program for retrieving the data from database

<html> 
<head> 
<title>Entitled Document</title> 
<script language="JavaScript" > 

function getSubmit() 
{ 

var Firstn = names.value ; 

var cn = new ActiveXObject("ADODB.Connection"); 

var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:/clientDB.mdb"; 
var rs = new ActiveXObject("ADODB.Recordset"); 


var SQL = "select Surname, DOB from Customers where FirstName = '" + Firstn + "'"; 

cn.Open(strConn); 
rs.Open(SQL, cn); 
surname.value = rs(1); 
DOB.value = rs(2); 

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>
Member Avatar
goaway
Newbie Poster
2 posts since Oct 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Just use the "Save as web page" option in the File menu.

Thanks for the help.

But I had a query, where the database connection specified here, is FOR A sql SERVER .

var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:/clientDB.mdb"; 
var rs = new ActiveXObject("ADODB.Recordset");

Now , do I have to configure my Access Database in someway?

Here is my HTML Code:

<head>
Select STATE: <SELECT NAME="entry4">
<OPTION VALUE="no1">STATE
</SELECT>
<form>
MONDAY
<input type="checkbox" />
<br />
TUESDAY
<input type="checkbox"/>
<br />
WEDNESDAY
<input type="checkbox"/>
<br />
THURSDAY
<input type="checkbox"/>
<br />
FRIDAY
<input type="checkbox"/>
<br />
SATURDAY
<input type="checkbox"/>
<br />
SUNDAY
<input type="checkbox"/>
</form> 
To submit the query, press: 
<INPUT TYPE="submit" VALUE="Submit Query">. <P>
</head>
<html>
  <head>
    <h1>Accessing Data through HTML and Access</h1>
  </head>
  <body>
    Looking at Excel Web Components to create a DAP
  </body>
</hmtl>

The idea is to select teh state and day

I have a ACCESS DB, which has all the details of a partuclar state and its working hours.

Need help in connecting both of them.

Thank You

Member Avatar
hitmale11
Newbie Poster
1 post since Apr 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

i read above and do try it but some error
Line no. :20
char:1
Error: No value give for one or more required parameters.
code: 0
URL: file://c:\documents \...\...\...\.html

Member Avatar
HenniePj
Newbie Poster
1 post since May 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi Guys,

Here is the same code in javascript and it works 100%. I'm so proud...:'(

<html> 
    <head> 
        <title>Entitled Document</title> 
        <script language="JavaScript"> 
        function getSubmit() 
	{ 
	var LastName; 
	var Firstn = names.value ; 

 
            	var cn = new ActiveXObject("ADODB.Connection"); 
            	var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = ClientDB.mdb;Persist Security Info=False"; 
            	cn.Open(strConn);
		var rs = new ActiveXObject("ADODB.Recordset"); 
		var SQL = "select Surname, DOB from Customers where FirstName = '" + Firstn + "'";

		rs.Open(SQL, cn); 
		surname.value = rs(0); 
		DOB.value = rs(1); 
            	rs.Close(); 
            	cn.Close();   
        } 
        </script> 
    </head> 
    <body> 

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

	</body> 

</html>
Member Avatar
alphatechnology
Newbie Poster
1 post since Jun 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
-1
 

I am developing a website in html in which the contact us page i have to connect to MS-Excel database i am not able to get it ,can any one tell me how to get that one.

Member Avatar
Sonu Rohilla
Newbie Poster
1 post since Jun 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
-1
 

Hi,
I want to connect my html pages with access databese.
Can any of one help me?
Sonu Rohilla

Member Avatar
namadi
Newbie Poster
1 post since Jun 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Please help me with code I will use to connect my xhtml web page with my access database.
You can replay by posting on this page or send me message through this e-mail [snipped]

Thank You

Start New Discussion
Tags Related to this Article