Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing Access databases in JavaScript?

Status
Not open for further replies.

greenber

Technical User
Jul 6, 2016
3
0
0
US
I have a front end written using classic ASP. One of its elements is a select/option drop-down menu using Onchange. As such the user will scroll through a bunch of database records, no problem at all using ASP. When the Onchange fires it causes a function, a *JavaScript* function, in the header to be executed. I have no problem constructing the appropriate SQL statement in the form of
"select * where ID=value"

How do I open the desired database (XYZ.MDB, for example) and execute the constructed SQL upon it, all in JavaScript?

(Oh, the database resides on a remote server, protected by a userID/password)


 
Short answer: not at all.
JS is executed in the browser, i.e. client-side, and has therefore no access to your server-side database.
Database calls must be done in your ASP part.

Intermediate answer: Take a look at this:

Long answer: does it have to be _classic_ ASP?
You might want to look into ASP.Net, maybe even MVC, use AJAX, and live a safer, less stressful life.

"Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family." (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
P.S: Seeing as this is about an Access database and classic ASP rather than SQL Server, you better post it here instead:
forum333


"Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family." (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
This is clearly the wrong forum for this question.

However, from past experience, I know it is possible. You can use javascript with ajax on the client side to access particular pages on the server. Based on parameters passed to the server page (which can be classic ASP), it would return a result to your ajax call on the client side.

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top