Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 8th, 2016, 09:28 PM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2016
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default Access database from JavaScript?

I have a page in VBScript that among other elements in a form is a select/option drop-down using Onchange to call to a function in the header. Once there I want to open an Access database on the server and execute an SQL statement of the form "select * where ID=17". I have no problem opening up the database in ASP but how do I do so in JavaScript?
Reply With Quote
  #2 (permalink)  
Old July 11th, 2016, 04:33 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,955
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

Why would you want to do this? This would mean all your clients would have direct access to your database server which is a bad idea for lots of reasons security being a big one).

Instead, you would write serve side pages or services that exposes the data to the client. The client then makes an AJAX call to that service which returns the data which in turn can be used client side.

Maybe not the answer you're looking for, but a safer and cleaner solution nonetheless in my opinion.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old July 11th, 2016, 09:31 AM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2016
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

That makes perfect sense!

However, I've no idea of how to do what you suggest… <Sigh>

Do you have some example code laying about? It would, at the very least, give me an idea of where to start.

Thank you.
Reply With Quote
  #4 (permalink)  
Old July 11th, 2016, 10:40 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,955
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

Hi there,

It depends a bit on the technology you use. For Classic ASP, this might be useful:

http://stackoverflow.com/questions/6...ic-asp/6977387
http://stackoverflow.com/questions/2...om-classic-asp

You would create an asp page (say, GetProducts.asp) that you call from the client using AJAX. That asp page connects to the database, gets the products and returns the product data as a JSON structure.

If you have access to something more modern like ASP.NET Web API, you can make this a lot easier:

http://www.asp.net/web-api
http://stackoverflow.com/questions/9...l-using-chrome

With Web API you do more or less the same thing: connect to the database and get your data. But then you can let the framework handle the conversion from your data to JSON.

Whatever your server side technology, you need something to request and process the data. jQuery - and its AJAX functionality - is a good option:

http://jquery.com/
https://www.google.com/?gws_rd=ssl#q...th+jQuery+ajax
http://api.jquery.com/category/ajax/

Lots of new technologies and concepts to master, but depending on what you're building, well worth the time invested.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
greenber (July 11th, 2016)
  #5 (permalink)  
Old July 11th, 2016, 01:04 PM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2016
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Gosh -- that's a great deal to learn for a relatively easy donation site. At least I had previously thought it "easy"
Reply With Quote
  #6 (permalink)  
Old July 11th, 2016, 06:54 PM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,955
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

Well, it doesn't have to be so complicated for a simple setup.

You could also handle all of this server side; you can post information to the server (using an HTML <form> element with a method of post) and then on the server handle that as a different case from the initial load. When the form is posting back, you call out to the database, get the data and then display it on screen.

Does that help?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #7 (permalink)  
Old July 12th, 2016, 12:48 PM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2016
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I'm lucky. My hosting service (http://www.readyhosting.net) provides native MSAccess services.
Reply With Quote
  #8 (permalink)  
Old July 12th, 2016, 04:19 PM
OC1971
Guest
 
Posts: n/a
Default Finally

Finally I found asnwer for this question.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Read Access database in Javascript philippeanto ASP.NET 4 General Discussion 1 February 10th, 2012 07:57 PM
Javascript Access Database Query panuvin Javascript How-To 28 May 9th, 2008 02:53 PM
access sql database using javascript vivek_inos Javascript How-To 2 October 12th, 2006 02:29 PM
Access Database from Javascript with rds nosreg Access 2 February 3rd, 2005 07:19 PM



All times are GMT -4. The time now is 07:31 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.