Question

Data Entry to Access MDB via asp web page

Asked by: PhilAllenpja

I have a website which has been built  and i am working on the next stage, but all this is new to me Please see http://eurobusxpo.com, within the exhibitors section i would like to add another tab (which i can do easily ) that opens a new page, and on that i would like there to be a form in which exhibitors can fill out with their information, this needs to be stored in a access database :

Contact Name:
Contact Email:
Company Name:
Tel:
Fax:
Website:
General email address:
Company Description (no more than 50 words max)
Member of CPT - (Tick Box)

All info here will be required before sending and needs to be sent to the access database and a copy emailed to an administrators email address internally and then also to the person that has entered the information ! I would also like it if there is some way in which this page could not get spammed . . .

As i have not done database connections nor pages before i am trying to find a step by step walkthrough to enable me to get this done  . . . . YESTERDAY !

Can anyone help me ??

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-04-11 at 02:38:19ID23314516
Tags

ASP, XML

,

All Main

,

http://www.eurobusxpo.com

Topics

Active Server Pages (ASP)

,

Miscellaneous Web Development

Participating Experts
2
Points
500
Comments
11

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Any walkthrough tutorial on C#, mdb, etc.?
    Hi, I am learning .Net and C#. I would like to learn how to load in an access DB nwind.mdb. I tried a few walkthrough tutorials from microsoft's web site but got confused at the data adpter wizard. Basically, when I clicked on the "New Connection" button in that Wi...
  2. Fax
    What I need. When my fax is receiving fax, I need to send this fax to a database that locat on the web server. Then from any please I can read all coming faxes online. I will just display them on ASP page. Do you have any ideas?

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: fiboPosted on 2008-04-11 at 03:00:33ID: 21332621

If it needs to be done by yesterday, just focus on the database thing and forget emails for the time being.
Concentrate also on filtering input data so that it does not generate wrong data or safety holes.

Using your form with POST type, clicking on the 'submit' button will lead you to the "database writing" page, where you will get back the POSTed data and filer it, then add the corresponding record.

Spend 30 minutes reading and implementing the tutorial at
http://www.webwizguide.com/kb/asp_tutorials/connecting_to_a_database.asp
then use your newly-gained knowledge to finish your project.
Again, don't try to do everything at once. What you need first is really to get this database up and running (let's say this is version 0.99). Sending by mail will be done calmly at a later stage, as part of a 1.01 version/

 

by: PhilAllenpjaPosted on 2008-04-11 at 05:00:46ID: 21333296

ok first tutorial sailed through, the next one adding brings back a 500 internal server error ???? this is my code for the adapted "Add_to_comments.asp" page my page is called "add_to_exhibitor_cat_entry.asp" :-

<%
'Dimension variables
Dim adoCon          'Holds the Database Connection Object
Dim rsAddCatentry   'Holds the recordset for the new record to be added
Dim strSQL          'Holds the SQL query to query the database
 
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
 
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("cat_entry_info.mdb") 
 
'Create an ADO recordset object
Set rsAddcatalogueentry = Server.CreateObject("ADODB.Recordset") 
 
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblcatalogueentry.Contact_name, tblcatalogueentry.Contact_email, tblcatalogueentry.Company_name, tblcatalogueentry.Tel, tblcatalogueentry.Fax, tblcatalogueentry.Website, tblcatalogueentry.General_email, tblcatalogueentry.Company_description FROM tblcatalogueentry;"
 
'Set the cursor type we are using so we can navigate through the recordset
rsAddcatalogueentry.CursorType = 2
 
'Set the lock type so that the record is locked by ADO when it is updated
rsAddcatalogueentry.LockType = 3
 
'Open the recordset with the SQL query 
rsAddcatalogueentry.Open strSQL, adoCon
 
'Tell the recordset we are adding a new record to it
rsAddcatalogueentry.AddNew
 
'Add a new record to the recordsethn    
rsAddcatalogueentry.Fields("Contact_name") = Request.Form("name")
rsAddcatalogueentry.Fields("Contact_email") = Request.Form("email")
rsAddcatalogueentry.Fields("Company_name") = Request.Form("Cname")
rsAddcatalogueentry.Fields("Tel") = Request.Form("t")
rsAddcatalogueentry.Fields("Fax") = Request.Form("f")
rsAddcatalogueentry.Fields("Website") = Request.Form("w")
rsAddcatalogueentry.Fields("General_email") = Request.Form("ge")
rsAddcatalogueentry.Fields("Company_description") = Request.Form("cd")
 
'Write the updated recordset to the database
rsAddcatalogueentry.Update
 
'Reset server objects
rsAddcatalogueentry.Close
Set rsAddcatalogueentry = Nothing
Set adoCon = Nothing
 
'Redirect to the guestbook.asp page
Response.Redirect "company_info.asp"
%> 

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:

Select allOpen in new window

 

by: fiboPosted on 2008-04-11 at 06:26:56ID: 21333987

The error 500 message is not very helpful: it could have lots of causes.

You will find at
http://classicasp.aspfaq.com/general/why-do-i-get-a-500-internal-server-error-for-all-asp-errors.html
a parameter setting to help your IE to display a more meaningfule message.

OTHER:
- check what is the database contente, even if adding generated errors
- what is the primary key field in your table? would your test data creat a problem for that?
- test filling in your records just name, email and any primary key; if that workds, you can concntrate on the others.

 

by: JagCPosted on 2008-04-11 at 06:50:06ID: 21334211

If using IE go to Tools, Internet Options... and click the Advanced tab.
Then scroll down until you see an option called "Show friendly HTTP error messages" and UNCHECK it.

Never have this checked when writing code :) When you run the page it should now give you an error and a line number.

 

by: PhilAllenpjaPosted on 2008-04-11 at 07:01:49ID: 21334327

Database error for read/write permissions so now sorted . . . i am working my way through the remainder of the guide and have a few other bits . . . . so watch out !

 

by: PhilAllenpjaPosted on 2008-04-11 at 08:11:17ID: 21334983

Ok so i have follwed these step by step guides . . ..  and understand how the database is connecting ! and managed to get it adding, deleting and updating  , , , so how do i know go about integrating this onto the asp pages via xml content ?? and css styling ?

 

by: JagCPosted on 2008-04-11 at 08:33:13ID: 21335214

Unless you _need_ XML I wouldn't complicate matters with it.

You say you have managed to get it updating. How are you doing this? If it is a form that populated the fields with database info for the user to edit and then click save (or similar) then the 'display' page will be pretty similar - just write the info to the page.

If, however, you don't actually have a way to edit then I here's how in pseudo code.

Open a connection to the database
define your sql statement
set your recordset object with the results of the sql query
Use getrows() to pull the info from the recordset into an array
close the database

What you will have then is an array with all the info in. This will always be a 2D array whether only one records are retrieved or many.

If you want to display a list then create a table with 2 rows: the first for the column headers and a second inside a for loop that will loop through your content array and display the appropriate info.

Of, if you just want to display one record then create a table or whatever layout you wish to use, then simply response.write() the bits of the array you wish to display to the user.

 

by: PhilAllenpjaPosted on 2008-04-11 at 09:13:29ID: 21335589

ok thats all sounds good but i am getting this error when trying to update the data in the database now ....

ADODB.Recordset error '800a0cb3'

Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.

/data/update_cat_entry.asp, line 31


 

by: JagCPosted on 2008-04-11 at 09:43:40ID: 21335855

This is usually the line that is something like:

'Set the lock type so that the record is locked by ADO when it is updated
rsAddcatalogueentry.LockType = 3

Try setting the locktype to 2 or if that doesn't work try -1 :)
Don't use 1 (that's read only) or 4 (for batch updates)

Another one that catches people out when using Access is this:
 The database MUST be editable by the user set in your web server

To clarify:
Whenever a file is requested from a web server that file will be accessed by a window user account. By default, IIS creates a user called IUSR_MACHINENAME (where MACHINENAME is the 'name' of your pc/server etc).
By default this user is a member of guests and can't log on.

So, this user needs to have read access to the files your web server needs to dish out.
If accessing an Access database it therefore also needs permission to read it. And, if you want to write to the database, it needs permission to edit it too.

If using IIS, open it, find your site in the list on the left, right click it and click Properties. Under the Directory Security tab click the Edit button next to Authentication and Access Control.
If hte user is "IUSR_servername" then that's fine, click cancel to close all the windows.
Next, go to the folder where the database is, right click it and hit properties.
Click the security tab.
If the IUSR_servername IS on the list make sure it is CHECKED under ALLOW and next to Modify. If not, check it and hit APPLY. Then, while this window is open, click ADVANCED.
Uncheck the "Inherit from parent blah blah blah" and check the "Replace permission entries blah blah blah".
What this will do is make sure that the web user has access to the database and can write to it.

Then give it another go.

(Usually when setting up a site all this security stuff is part of it. But if you're new to DB driven sites there can be several little things like this that get in the way. But once you know 'em you're off!)

good luck :)

 

by: PhilAllenpjaPosted on 2008-04-17 at 02:35:46ID: 21375444

Ok I have now managed to get the form online but am getting an error about where the database is held :Server.MapPath() error 'ASP 0172 : 80004005'

Invalid Path

/company_info.asp, line 17

The Path parameter for the MapPath method must be a virtual path. A physical path was used.

i have the included code on this line, what have i done wrong ????



 'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("d:\customer\eurobusxpo\database\cat_entry_info.mdb") 

                                              
1:
2:

Select allOpen in new window

 

by: JagCPosted on 2008-04-18 at 07:06:15ID: 21385845

Server.MapPath("d:\customer\eurobusxpo\database\cat_entry_info.mdb"

is the problem.

If you know the path (which you do) then don't bother with Server.MapPath. This is usually only used when you don't know the "actual" path to the DB file such as when it's hosted on a shared server.

Just use:
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=d:\customer\eurobusxpo\database\cat_entry_info.mdb"

Better still, create a common include file and in it stick a variable called ConnString or something similar. Then assign it "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=d:\customer\eurobusxpo\database\cat_entry_info.mdb"

Use SSI to include this common file on every page then you only need to do:
adoCon.Open ConnString

So, if the database path ever changes (moving server etc) all you need to do is change one file - the include file - instead of having to update every page on the site.




20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...