473,398 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Trying to get ASP form to show up in Access Database

Hello, I am new to this forum but have read several posts and I thank you for your great assistance. I am stumped right now. I have a user registration form in asp that is set to a form method=registration.asp page. i will post my registration.asp page below.

I am hoping this asp page will connect to my access database called registration.mdb with a table called registration. however, everytime i submit my registration information, I get an error page that says there is a programming error. I have the SAMS teach yourself ASP 3.0 book and have followed this but am having no luck. Does anyone know why this isn't working. The current page I have listed below is trying to use the dsn-less connection. I also tried the dsn connection but failed there too. Any help would be greatly appreciated. Thanks in advance - Jerry
__________________________________________________ _____________

Expand|Select|Wrap|Line Numbers
  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <!--#include virtual="/adovbs.inc"-->
  4. <html>
  5. <body>
  6. <%
  7. Dim objConn
  8. Set objConn = Server.CreateObject("ADODB.Connection")
  9. objConn.ConnectionString="Driver={Microsoft Access Driver (*.mdb)};" & _
  10. "DBQ=C:\Documents and Settings\MM\Desktop\Website\registration.mdb"
  11. objConn.Open
  12.  
  13. Dim objRS, bolAlreadyExists
  14. If ((Request.Form("firstname") = "") OR (Request.Form("lastname") = "") _
  15.     OR (Request.Form("street") = "") OR (Request.Form("city") = "") _
  16.     OR (Request.Form("state") = "") OR (Request.Form("zipcode") = "") _
  17.     OR (Request.Form("birthdate") = "") oR (Request.Form("email") = "") _
  18.     OR (Request.Form("confirmemail") = "") oR (Request.Form("password") = "") _
  19.     OR (Request.Form("confirmpassword") = "") oR (Request.Form("question") = "") _
  20.     OR (Request.Form("answer") = "") oR (Request.Form("confirmanswer") = "") _
  21.     OR (Request.Form("interest") = "") oR (Request.Form("nonewsemail") = "") _
  22.     OR (Request.Form("hearabout") = "")
  23.  
  24.   Response.Write "<a href='registration.html'>"
  25.   Response.Write "You must enter values for all the fields."
  26.   Response.Write "</a>"
  27. Else
  28. bolAlreadyExists = False
  29. Set objRS = Server.CreateObject("ADODB.Recordset")
  30. objRS.Open "registration", objConn, , adLockOptimistic, adCmdTable
  31. Do While Not (objRS.EOF OR bolAlreadyExists)
  32. If (StrComp(objRS("email"), Request.Form("email"), _
  33. vbTextCompare) = 0) Then
  34. Response.Write "<a href='registration.html'>"
  35. Response.Write "Email address already found in table."
  36. Response.Write "</a>
  37. bolAlreadyExists = True
  38. End If
  39. objRS.MoveNext
  40. Loop
  41. If Not bolAlreadyExists Then
  42.  
  43. objRS.AddNew
  44.  
  45.     objRS("firstname") = Request.Form("firstname")
  46.     objRS("lastname") = Request.Form("lastname")
  47.     objRS("street") = Request.Form("street")
  48.     objRS("city") = Request.Form("city")
  49.     objRS("state") = Request.Form("state")
  50.     objRS("zipcode") = Request.Form("zipcode")
  51.     objRS("birthdate") = Request.Form("birthdate")
  52.     objRS("email") = Request.Form("email")
  53.     objRS("confirmemail") = Request.Form("confirmemail")
  54.     objRS("password") = Request.Form("password")
  55.     objRS("confirmpassword") = Request.Form("confirmpassword")
  56.     objRS("question") = Request.Form("question")
  57.     objRS("answer") = Request.Form("answer")
  58.     objRS("confirmanswer") = Request.Form("confirmanswer")
  59.     objRS("awardprogram") = Request.Form("awardprogram")
  60.     objRS("accountnumber") = Request.Form("accountnumber")
  61.     objRS("interest") = Request.Form("interest")
  62.     objRS("nonewsemail") = Request.Form("nonewsemail")
  63.     objRS("hearabout") = Request.Form("hearabout")
  64.     objRS.Update
  65.     Response.Write "Thank you for registering."
  66.   End If
  67.   objRS.Close
  68.   Set objRS = Nothing
  69. End If
  70. objConn.Close
  71. Set objConn = Nothing
  72. %>
  73. </body>
  74. </html>
Oct 28 '08 #1
24 3670
one other question to go with my previous post. i am currently trying to use html/asp/microsoft access. would it be easier to use php/mysql? i have a hosting account at godaddy and they allow both i believe. i have read that php/mysql is easier but i have set everything up in asp/access thus far. just curious because i am new to web design but very facinated by it. my webpage is pretty basic. just a page for users to register, then check their points earned balances and edit their registration info if necessary. if i can figure out how to get their user info into a database, i feel i am almost there.

any guidance to the correct scripting languages would be very beneficial.

thanks in advance - Jerry
Oct 29 '08 #2
DrBunchman
979 Expert 512MB
Hi Jerry,

Firstly, welcome to Bytes.com! I hope you find the site useful.

Secondly, please don't forget to wrap your code in CODE tags - it makes your posts much easier to read - and please read the Posting Guidelines if you have not done so already.

Could you print the error that you are getting on your page please. Make sure that you have Friendly HTTP Error Messages turned off in your browser options so you can see the actual error that is being returned.

Thanks,

Dr B
Oct 29 '08 #3
Thank you for your quick response Dr. B. Below is the error message I am getting. My connection to the internet is fine so I am not sure what is going on. Any ideas?

__________________________________________________ ____________

Internet Explorer cannot display the webpage

Most likely causes:
You are not connected to the Internet.
The website is encountering problems.
There might be a typing error in the address.

What you can try:
Diagnose Connection Problems

More information

This problem can be caused by a variety of issues, including:

Internet connectivity has been lost.
The website is temporarily unavailable.
The Domain Name Server (DNS) is not reachable.
The Domain Name Server (DNS) does not have a listing for the website's domain.
If this is an HTTPS (secure) address, click Tools, click Internet Options, click Advanced, and check to be sure the SSL and TLS protocols are enabled under the security section.

For offline users

You can still view subscribed feeds and some recently viewed webpages.
To view subscribed feeds

Click the Favorites Center button , click Feeds, and then click the feed you want to view.

To view recently visited webpages (might not work on all pages)

Click Tools , and then click Work Offline.
Click the Favorites Center button , click History, and then click the page you want to view.
Oct 29 '08 #4
The last post was the error message I received when I tried to submit offline.
When I put my webpages on the ftp client and try to submit, I get the following error message.
__________________________________________________ ________

Microsoft VBScript compilation error '800a03ee'

Expected ')'

/registration.asp, line 22

OR (Request.Form("hearabout") = "")
-----------------------------------^
Oct 29 '08 #5
sorry for multiple posts but I went into my registration.asp page and deleted the
"hearabout" line that caused the problem last time and got the following error message. I really appreciate your help. Thanks again.
__________________________________________________ ______


Microsoft VBScript compilation error '800a03ee'

Expected ')'

/registration.asp, line 24

Response.Write "<a href='registration.html'>"
^
Oct 29 '08 #6
DrBunchman
979 Expert 512MB
The error is obviously that you have a missing parenthesis somewhere but the question is where. Can you print a bit more of the code that comes before this line so I can see what is going on please.

Thanks,

Dr B
Oct 29 '08 #7
i am not sure what code you would like me to post but here is the registration.asp page I have been using. If you would like me to post anything else, please let me know.

Expand|Select|Wrap|Line Numbers
  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <!--#include virtual="/adovbs.inc"-->
  4. <html>
  5. <body>
  6. <%
  7. Dim objConn
  8. Set objConn = Server.CreateObject("ADODB.Connection")
  9. objConn.ConnectionString="Driver={Microsoft Access Driver (*.mdb)};" & _
  10. "DBQ=C:\Documents and Settings\MM\Desktop\Website\registration.mdb"
  11. objConn.Open
  12.  
  13. Dim objRS, bolAlreadyExists
  14. If ((Request.Form("firstname") = "") OR (Request.Form("lastname") = "") _
  15.     OR (Request.Form("street") = "") OR (Request.Form("city") = "") _
  16.     OR (Request.Form("state") = "") OR (Request.Form("zipcode") = "") _
  17.     OR (Request.Form("birthdate") = "") oR (Request.Form("email") = "") _
  18.     OR (Request.Form("confirmemail") = "") oR (Request.Form("password") = "") _
  19.     OR (Request.Form("confirmpassword") = "") oR (Request.Form("question") = "") _
  20.     OR (Request.Form("answer") = "") oR (Request.Form("confirmanswer") = "") _
  21.     OR (Request.Form("interest") = "") oR (Request.Form("nonewsemail") = "") _
  22.  
  23.  
  24.   Response.Write "<a href='registration.html'>"
  25.   Response.Write "You must enter values for all the fields."
  26.   Response.Write "</a>"
  27. Else
  28. bolAlreadyExists = False
  29. Set objRS = Server.CreateObject("ADODB.Recordset")
  30. objRS.Open "registration", objConn, , adLockOptimistic, adCmdTable
  31. Do While Not (objRS.EOF OR bolAlreadyExists)
  32. If (StrComp(objRS("email"), Request.Form("email"), _
  33. vbTextCompare) = 0) Then
  34. Response.Write "<a href='registration.html'>"
  35. Response.Write "Email address already found in table."
  36. Response.Write "</a>
  37. bolAlreadyExists = True
  38. End If
  39. objRS.MoveNext
  40. Loop
  41. If Not bolAlreadyExists Then
  42.  
  43. objRS.AddNew
  44.  
  45.     objRS("firstname") = Request.Form("firstname")
  46.     objRS("lastname") = Request.Form("lastname")
  47.     objRS("street") = Request.Form("street")
  48.     objRS("city") = Request.Form("city")
  49.     objRS("state") = Request.Form("state")
  50.     objRS("zipcode") = Request.Form("zipcode")
  51.     objRS("birthdate") = Request.Form("birthdate")
  52.     objRS("email") = Request.Form("email")
  53.     objRS("confirmemail") = Request.Form("confirmemail")
  54.     objRS("password") = Request.Form("password")
  55.     objRS("confirmpassword") = Request.Form("confirmpassword")
  56.     objRS("question") = Request.Form("question")
  57.     objRS("answer") = Request.Form("answer")
  58.     objRS("confirmanswer") = Request.Form("confirmanswer")
  59.     objRS("awardprogram") = Request.Form("awardprogram")
  60.     objRS("accountnumber") = Request.Form("accountnumber")
  61.     objRS("interest") = Request.Form("interest")
  62.     objRS("nonewsemail") = Request.Form("nonewsemail")
  63.     objRS("hearabout") = Request.Form("hearabout")
  64.     objRS.Update
  65.     Response.Write "Thank you for registering."
  66.   End If
  67.   objRS.Close
  68.   Set objRS = Nothing
  69. End If
  70. objConn.Close
  71. Set objConn = Nothing
  72. %>
  73. </body>
  74. </html>
Oct 29 '08 #8
GazMathias
228 Expert 128KB
Hiya,

I think your problem is that you open a parenthesis here:

Expand|Select|Wrap|Line Numbers
  1. If ((Request.Form("firstname") = "") OR (Request.Form("lastname") 
But I can't find where it is closed.
Oct 29 '08 #9
thank you for your response.

i added a parentheses at the end of this statement after "nonewsemail"

Expand|Select|Wrap|Line Numbers
  1. Dim objRS, bolAlreadyExists
  2. If ((Request.Form("firstname") = "") OR (Request.Form("lastname") = "") _
  3.     OR (Request.Form("street") = "") OR (Request.Form("city") = "") _
  4.     OR (Request.Form("state") = "") OR (Request.Form("zipcode") = "") _
  5.     OR (Request.Form("birthdate") = "") oR (Request.Form("email") = "") _
  6.     OR (Request.Form("confirmemail") = "") oR (Request.Form("password") = "") _
  7.     OR (Request.Form("confirmpassword") = "") oR (Request.Form("question") = "") _
  8.     OR (Request.Form("answer") = "") oR (Request.Form("confirmanswer") = "") _
  9.     OR (Request.Form("interest") = "") oR (Request.Form("nonewsemail") = "")) Then
  10.  
  11.  
  12.   Response.Write "<a href='registration.html'>"
  13.   Response.Write "You must enter values for all the fields."
  14.   Response.Write "</a>"
after i made the above change, i got the following error code.
__________________________________________________

Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/registration.asp, line 36

Response.Write "</a>
--------------------^
Oct 29 '08 #10
hello again, I have been messing around with the error code I received as shown in the post above.

If I add an additional " to my registration.asp code like this "</a>"", I receive the following error

****Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/registration.asp, line 36

Response.Write "</a>""



It seems that if I put more quotations around this they show up in the error code but if I only have "</a>" then the error code looks like this....

****Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/registration.asp, line 36

Response.Write "</a>



I am not sure why it is not reading the last quotation even though I have
"</a>" in my code.

any ideas?
Oct 29 '08 #11
GazMathias
228 Expert 128KB
hello again, I have been messing around with the error code I received as shown in the post above.

If I add an additional " to my registration.asp code like this "</a>"", I receive the following error

****Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/registration.asp, line 36

Response.Write "</a>""



It seems that if I put more quotations around this they show up in the error code but if I only have "</a>" then the error code looks like this....

****Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/registration.asp, line 36

Response.Write "</a>



I am not sure why it is not reading the last quotation even though I have
"</a>" in my code.

any ideas?
On the code you posted in post #8, line 36 did contain an unterminated string:

Expand|Select|Wrap|Line Numbers
  1. Response.Write "</a> 
Can you post the updated code in its entirety?
Oct 30 '08 #12
thank you for your insight. i was looking at the wrong </a> section before, good catch. So, I corrected that and now I am having trouble with the connection to the access database. I set up a dsn connection called registration.dsn. I did this by going to the control panel/admin tools/data sources(ODBC)...Then I clicked the System DSN tab and added a connection(Microsoft Access Driver *.mdb), and i named this registration.dsn. I get the following error code
___
Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/registration.asp, line 10
____

here is my updated code. i have a hosting account with godaddy, would this cause the problem?

Expand|Select|Wrap|Line Numbers
  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <!--#include virtual="/adovbs.inc"-->
  4. <html>
  5. <body>
  6. <%
  7. Dim objConn
  8. Set objConn = Server.CreateObject("ADODB.Connection")
  9. objConn.ConnectionString = "DSN=registration.dsn"
  10. objConn.Open
  11. Dim objRS, bolAlreadyExists
  12. If ((Request.Form("firstname") = "") OR (Request.Form("lastname") = "") _
  13.     OR (Request.Form("street") = "") OR (Request.Form("city") = "") _
  14.     OR (Request.Form("state") = "") OR (Request.Form("zipcode") = "") _
  15.     OR (Request.Form("birthdate") = "") OR (Request.Form("email") = "") _
  16.     OR (Request.Form("confirmemail") = "") OR (Request.Form("password") = "") _
  17.     OR (Request.Form("confirmpassword") = "") OR (Request.Form("question") = "") _
  18.     OR (Request.Form("answer") = "") OR (Request.Form("confirmanswer") = "") _
  19.     OR (Request.Form("interest") = "") OR (Request.Form("nonewsemail") = "")) Then
  20.  
  21.  
  22.   Response.Write "<a href='registration.html'>"
  23.   Response.Write "You must enter values for all the fields."
  24.   Response.Write "</a>"
  25. Else
  26. bolAlreadyExists = False
  27. Set objRS = Server.CreateObject("ADODB.Recordset")
  28. objRS.Open "registration", objConn, , adLockOptimistic, adCmdTable
  29. Do While Not (objRS.EOF OR bolAlreadyExists)
  30. If (StrComp(objRS("email"), Request.Form("email"), _
  31. vbTextCompare) = 0) Then
  32. Response.Write "<a href='registration.html'>"
  33. Response.Write "Email address already found in table."
  34. Response.Write "</a>"
  35. bolAlreadyExists = True
  36. End If
  37. objRS.MoveNext
  38. Loop
  39. If Not bolAlreadyExists Then
  40.  
  41. objRS.AddNew
  42.  
  43.     objRS("firstname") = Request.Form("firstname")
  44.     objRS("lastname") = Request.Form("lastname")
  45.     objRS("street") = Request.Form("street")
  46.     objRS("city") = Request.Form("city")
  47.     objRS("state") = Request.Form("state")
  48.     objRS("zipcode") = Request.Form("zipcode")
  49.     objRS("birthdate") = Request.Form("birthdate")
  50.     objRS("email") = Request.Form("email")
  51.     objRS("confirmemail") = Request.Form("confirmemail")
  52.     objRS("password") = Request.Form("password")
  53.     objRS("confirmpassword") = Request.Form("confirmpassword")
  54.     objRS("question") = Request.Form("question")
  55.     objRS("answer") = Request.Form("answer")
  56.     objRS("confirmanswer") = Request.Form("confirmanswer")
  57.     objRS("awardprogram") = Request.Form("awardprogram")
  58.     objRS("accountnumber") = Request.Form("accountnumber")
  59.     objRS("interest") = Request.Form("interest")
  60.     objRS("nonewsemail") = Request.Form("nonewsemail")
  61.     objRS("hearabout") = Request.Form("hearabout")
  62.     objRS.Update
  63.     Response.Write "Thank you for registering."
  64.   End If
  65.   objRS.Close
  66.   Set objRS = Nothing
  67. End If
  68. objConn.Close
  69. Set objConn = Nothing
  70. %>
  71. </body>
  72. </html>
Oct 30 '08 #13
jhardman
3,406 Expert 2GB
try:
Expand|Select|Wrap|Line Numbers
  1. objConn.ConnectionString = "DSN=registration"
  2.  
Oct 30 '08 #14
Hi, thanks for you thoughts. However, using "DSN=registration" and dropping the .dsn gave me the same error code as before

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/registration.asp, line 10
Oct 30 '08 #15
jhardman
3,406 Expert 2GB
What kind of database are you using? and did you actually make the DSN?

Jared
Oct 30 '08 #16
hello, I am using a Microsoft Access database called registration.mdb with a table called registration.

I created the DSN by going to Start/Control Panel/Administrative Tools/Data Bases(ODBC)....then I clicked on the System DSN tab and added Microsoft Access Driver (*.mdb) and named it registration.dsn.

It shows up when i open up the Data Bases(ODBC) folder under the System DSN tab.

Not sure if this is the correct method, I am following steps from SAMS Teach Yourself ASP 3.0.

I tried to contact Godaddy.com where I have my hosting account through but they constantly tell me they are not allowed to assist with scripting so I am at a stand still.

However, godaddy.com does have a help section that has the following instructions describing using ASP/ADO to connect to an Access Database. How would I implement these instructions into my code listed above?


Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim oConn, oRs
  3. Dim qry, connectstr
  4. Dim db_path
  5. Dim db_dir
  6. db_dir = Server.MapPath("access_db") & "\"
  7. db_path = db_dir & "yourdatabasefile.mdb"
  8. fieldname = "your_field"
  9. tablename = "your_table"
  10.  
  11. connectstr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & db_path
  12.  
  13. Set oConn = Server.CreateObject("ADODB.Connection")
  14. oConn.Open connectstr
  15. qry = "SELECT * FROM " & tablename
  16.  
  17. Set oRS = oConn.Execute(qry)
  18.  
  19. if not oRS.EOF then
  20. while not oRS.EOF
  21. response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & "
  22. "
  23. oRS.movenext
  24. wend
  25. oRS.close
  26. end if
  27.  
  28. Set oRs = nothing
  29. Set oConn = nothing
  30.  
  31. %> 
Oct 30 '08 #17
GazMathias
228 Expert 128KB
hello, I am using a Microsoft Access database called registration.mdb with a table called registration.

I created the DSN by going to Start/Control Panel/Administrative Tools/Data Bases(ODBC)....then I clicked on the System DSN tab and added Microsoft Access Driver (*.mdb) and named it registration.dsn.

It shows up when i open up the Data Bases(ODBC) folder under the System DSN tab.

Not sure if this is the correct method, I am following steps from SAMS Teach Yourself ASP 3.0.

I tried to contact Godaddy.com where I have my hosting account through but they constantly tell me they are not allowed to assist with scripting so I am at a stand still.

However, godaddy.com does have a help section that has the following instructions describing using ASP/ADO to connect to an Access Database. How would I implement these instructions into my code listed above?


Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim oConn, oRs
  3. Dim qry, connectstr
  4. Dim db_path
  5. Dim db_dir
  6. db_dir = Server.MapPath("access_db") & "\"
  7. db_path = db_dir & "yourdatabasefile.mdb"
  8. fieldname = "your_field"
  9. tablename = "your_table"
  10.  
  11. connectstr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & db_path
  12.  
  13. Set oConn = Server.CreateObject("ADODB.Connection")
  14. oConn.Open connectstr
  15. qry = "SELECT * FROM " & tablename
  16.  
  17. Set oRS = oConn.Execute(qry)
  18.  
  19. if not oRS.EOF then
  20. while not oRS.EOF
  21. response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & "
  22. "
  23. oRS.movenext
  24. wend
  25. oRS.close
  26. end if
  27.  
  28. Set oRs = nothing
  29. Set oConn = nothing
  30.  
  31. %> 
I am starting to think your domain is hosted in shared webspace (on linux using SunOne ASP probably) and not on a dedicated Windows Server.

So can I ask on what machine you created the DSN? Was it your local PC or am I wrong, and you do have a dedicated Windows server and that is where you set it up?

Also the above Go Daddy code is illustrating a DSN-less connection to a database you specify stored in directory called "access_db" within the webspace, which then prints out the contents of the field you specify from the table you specify.
Oct 30 '08 #18
I am not sure exactly if I am answering your question correctly, but I will try my best.

I set up the DSN connection on my personal dell laptop.

I have a hosting account with godaddy.com and I have to upload my webpages(html, asp, mdb) to the FTP client they issued...I am not sure if this is a dedicated or shared site.

Do you think this is why it can't read my dsn connection? if so, is it possible to do what i am trying or do i have to use the godaddy tools? The problem is, when I contact them to ask questions, they simply state they are not allowed to help with 3rd party scripting.

Thank you for clearing up the godaddy code i posted. sounds like that code would assist me if i created a table on their website.

if you know of any way to set up a connection using my database i have created on godaddy.com's hosting account, please let me know

thanks so much for all of your help so far, it is much appreciated.
Oct 30 '08 #19
GazMathias
228 Expert 128KB
I am not sure exactly if I am answering your question correctly, but I will try my best.

I set up the DSN connection on my personal dell laptop.

I have a hosting account with godaddy.com and I have to upload my webpages(html, asp, mdb) to the FTP client they issued...I am not sure if this is a dedicated or shared site.

Do you think this is why it can't read my dsn connection? if so, is it possible to do what i am trying or do i have to use the godaddy tools? The problem is, when I contact them to ask questions, they simply state they are not allowed to help with 3rd party scripting.

Thank you for clearing up the godaddy code i posted. sounds like that code would assist me if i created a table on their website.

if you know of any way to set up a connection using my database i have created on godaddy.com's hosting account, please let me know

thanks so much for all of your help so far, it is much appreciated.
Yes the connection is failing because it can't see the DSN on your computer, and nor would you want it to.

You need to upload your access db into your webspace and create a DSN-less connection to it there.

I recommend that you do use Go Daddy's example code just to test the connection. When you know it works, then apply its principles to your page.

Just remember to change the MapPath, "yourfield", "yourtable" and yourdatabase" stuff to your actual database details. Or better yet use a very simple SQL statement so there's even less margin for error, something like:
Expand|Select|Wrap|Line Numbers
  1. SELECT field FROM table WHERE ID = 1
Then just write out that one value with:

Expand|Select|Wrap|Line Numbers
  1. <%=oRS("field")%>
Oct 30 '08 #20
ok, thanks. i will work on this tonight and let you know how it works out.
Oct 30 '08 #21
I looked on godaddy and they have a place to set up a DSN. I named my access_register.dsn.

I also found the following code to use to connect to the dsn

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim oConn, oRs
  3. Dim qry, connectstr, sDSNDir
  4. Dim db_name, db_username, db_userpassword
  5. Dim dsn_name
  6.  
  7. dsn_name = "your_dsn_name"
  8. fieldname = "your_fieldname"
  9. tablename = "your_tablename"
  10.  
  11. 'assumes that _dsn exists in the root
  12. sDSNDir = Server.MapPath("/_dsn")
  13.  
  14. connectstr = "filedsn=" & sDSNDir & "/" & dsn_name
  15.  
  16. Set oConn = Server.CreateObject("ADODB.Connection")
  17. oConn.Open connectstr
  18. qry = "SELECT * FROM " & tablename
  19.  
  20. Set oRS = oConn.Execute(qry)
  21.  
  22. if not oRS.EOF then
  23. while not oRS.EOF
  24. response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & " "
  25. oRS.movenext
  26. wend
  27. oRS.close
  28. end if
  29.  
  30. Set oRs = nothing
  31. Set oConn = nothing
  32.  
  33. %> 

I am going to continue to play with this but what can I eliminate from the above godaddy code if all I am trying to do is have the user register and have their information store into the database table I created in Access called registration? Do I just need to add in my code? Sorry for all the questions, I am so new to this but feel like i am very close to accomplishing this step.

Below is my current asp page code.

Expand|Select|Wrap|Line Numbers
  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <!--#include virtual="/adovbs.inc"-->
  4. <html>
  5. <body>
  6. <%
  7. Dim objConn
  8. Set objConn = Server.CreateObject("ADODB.Connection")
  9. objConn.ConnectionString = "DSN=access_register.dsn"
  10. objConn.Open
  11. Dim objRS, bolAlreadyExists
  12. If ((Request.Form("firstname") = "") OR (Request.Form("lastname") = "") _
  13.     OR (Request.Form("street") = "") OR (Request.Form("city") = "") _
  14.     OR (Request.Form("state") = "") OR (Request.Form("zipcode") = "") _
  15.     OR (Request.Form("birthdate") = "") OR (Request.Form("email") = "") _
  16.     OR (Request.Form("confirmemail") = "") OR (Request.Form("password") = "") _
  17.     OR (Request.Form("confirmpassword") = "") OR (Request.Form("question") = "") _
  18.     OR (Request.Form("answer") = "") OR (Request.Form("confirmanswer") = "") _
  19.     OR (Request.Form("interest") = "") OR (Request.Form("nonewsemail") = "")) Then
  20.  
  21.  
  22.   Response.Write "<a href='registration.html'>"
  23.   Response.Write "You must enter values for all the fields."
  24.   Response.Write "</a>"
  25. Else
  26. bolAlreadyExists = False
  27. Set objRS = Server.CreateObject("ADODB.Recordset")
  28. objRS.Open "registration", objConn, , adLockOptimistic, adCmdTable
  29. Do While Not (objRS.EOF OR bolAlreadyExists)
  30. If (StrComp(objRS("email"), Request.Form("email"), _
  31. vbTextCompare) = 0) Then
  32. Response.Write "<a href='registration.html'>"
  33. Response.Write "Email address already found in table."
  34. Response.Write "</a>"
  35. bolAlreadyExists = True
  36. End If
  37. objRS.MoveNext
  38. Loop
  39. If Not bolAlreadyExists Then
  40.  
  41. objRS.AddNew
  42.  
  43.     objRS("firstname") = Request.Form("firstname")
  44.     objRS("lastname") = Request.Form("lastname")
  45.     objRS("street") = Request.Form("street")
  46.     objRS("city") = Request.Form("city")
  47.     objRS("state") = Request.Form("state")
  48.     objRS("zipcode") = Request.Form("zipcode")
  49.     objRS("birthdate") = Request.Form("birthdate")
  50.     objRS("email") = Request.Form("email")
  51.     objRS("confirmemail") = Request.Form("confirmemail")
  52.     objRS("password") = Request.Form("password")
  53.     objRS("confirmpassword") = Request.Form("confirmpassword")
  54.     objRS("question") = Request.Form("question")
  55.     objRS("answer") = Request.Form("answer")
  56.     objRS("confirmanswer") = Request.Form("confirmanswer")
  57.     objRS("awardprogram") = Request.Form("awardprogram")
  58.     objRS("accountnumber") = Request.Form("accountnumber")
  59.     objRS("interest") = Request.Form("interest")
  60.     objRS("nonewsemail") = Request.Form("nonewsemail")
  61.     objRS("hearabout") = Request.Form("hearabout")
  62.     objRS.Update
  63.     Response.Write "Thank you for registering."
  64.   End If
  65.   objRS.Close
  66.   Set objRS = Nothing
  67. End If
  68. objConn.Close
  69. Set objConn = Nothing
  70. %>
  71. </body>
  72. </html>
Oct 30 '08 #22
ok, i tried to implement the godaddy code to connect to their shared server but i am coming across the following error

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x4500 Thread 0x4b9c DBC 0xa80d39c Jet'.

/registration2.asp, line 22


I know I have made some errors but I don't know where to begin to fix this error code. Here is my current asp processing page

Expand|Select|Wrap|Line Numbers
  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <!--#include virtual="/adovbs.inc"-->
  4. <html>
  5. <body>
  6. <%
  7. Dim oConn, oRs
  8. Dim connectstr, sDSNDir
  9. Dim db_name, db_username, db_userpassword
  10. Dim dsn_name, tablename
  11.  
  12. dsn_name = "access_register.dsn"
  13. tablename = "registration"
  14.  
  15. sDSNDir = Server.MapPath("/_dsn")
  16.  
  17. connectstr = "filedsn=" & sDSNDir & "/" & dsn_name
  18.  
  19. Set oConn = Server.CreateObject("ADODB.Connection")
  20. oConn.Open connectstr
  21.  
  22. Dim objRS, bolAlreadyExists
  23. If ((Request.Form("firstname") = "") OR (Request.Form("lastname") = "") _
  24.     OR (Request.Form("street") = "") OR (Request.Form("city") = "") _
  25.     OR (Request.Form("state") = "") OR (Request.Form("zipcode") = "") _
  26.     OR (Request.Form("birthdate") = "") OR (Request.Form("email") = "") _
  27.     OR (Request.Form("confirmemail") = "") OR (Request.Form("password") = "") _
  28.     OR (Request.Form("confirmpassword") = "") OR (Request.Form("question") = "") _
  29.     OR (Request.Form("answer") = "") OR (Request.Form("confirmanswer") = "") _
  30.     OR (Request.Form("interest") = "") OR (Request.Form("nonewsemail") = "")) Then
  31.  
  32.  
  33.   Response.Write "<a href='registration.html'>"
  34.   Response.Write "You must enter values for all the fields."
  35.   Response.Write "</a>"
  36. Else
  37. bolAlreadyExists = False
  38. Set objRS = Server.CreateObject("ADODB.Recordset")
  39. objRS.Open "registration", objConn, , adLockOptimistic, adCmdTable
  40. Do While Not (objRS.EOF OR bolAlreadyExists)
  41. If (StrComp(objRS("email"), Request.Form("email"), _
  42. vbTextCompare) = 0) Then
  43. Response.Write "<a href='registration.html'>"
  44. Response.Write "Email address already found in table."
  45. Response.Write "</a>"
  46. bolAlreadyExists = True
  47. End If
  48. objRS.MoveNext
  49. Loop
  50. If Not bolAlreadyExists Then
  51.  
  52. objRS.AddNew
  53.  
  54.     objRS("firstname") = Request.Form("firstname")
  55.     objRS("lastname") = Request.Form("lastname")
  56.     objRS("street") = Request.Form("street")
  57.     objRS("city") = Request.Form("city")
  58.     objRS("state") = Request.Form("state")
  59.     objRS("zipcode") = Request.Form("zipcode")
  60.     objRS("birthdate") = Request.Form("birthdate")
  61.     objRS("email") = Request.Form("email")
  62.     objRS("confirmemail") = Request.Form("confirmemail")
  63.     objRS("password") = Request.Form("password")
  64.     objRS("confirmpassword") = Request.Form("confirmpassword")
  65.     objRS("question") = Request.Form("question")
  66.     objRS("answer") = Request.Form("answer")
  67.     objRS("confirmanswer") = Request.Form("confirmanswer")
  68.     objRS("awardprogram") = Request.Form("awardprogram")
  69.     objRS("accountnumber") = Request.Form("accountnumber")
  70.     objRS("interest") = Request.Form("interest")
  71.     objRS("nonewsemail") = Request.Form("nonewsemail")
  72.     objRS("hearabout") = Request.Form("hearabout")
  73.     objRS.Update
  74.     Response.Write "Thank you for registering."
  75.   End If
  76.   objRS.Close
  77.   Set objRS = Nothing
  78. End If
  79. objConn.Close
  80. Set objConn = Nothing
  81. %>
  82. </body>
  83. </html>
Oct 31 '08 #23
GazMathias
228 Expert 128KB
This Page suggests that the problem is with file permissions. I suggest you look there.

I still also believe you should attempt to connect using a very basic page and, once that works, apply the same principles to your registration page.
Oct 31 '08 #24
thank you so much for all of your help.

i followed your recommendation and cut down my form code. then i kept plugging away at the godaddy.com code they provided and eventually, I got my registration form submit info to show up in the access table.

so, my question has been answered and i am moving on to the next step. thank you all again, I really appreciate the help. this website is a true blessing. have a nice weekend, and i am sure i will be asking questions down the road.....

Jerry
Nov 1 '08 #25

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Pete | last post by:
Before I get started with the question, does anyone have a (single) good book recommendation for database design? Not an Access-specific book, but something geared toward helping me figure out...
1
by: Michael Eisner | last post by:
I have an MS Access 8.0 (Office97) program that has a form called FO-008 that I need to replace on several users computers in different locations without me being there doing it manually. I'm...
3
by: RAllsopp | last post by:
I have a client who would like to have several pictures associated with one system. I have read about storing only the pathname to save OLE overhead and have set-up a form for my client to...
10
by: motessa | last post by:
Hello All, I am new to Access and have been looking for answers to my problem on the internet and have not found it yet. I hope someone can give me a hint. Thanks so much. I have a form...
4
by: raj_genius | last post by:
I hav two queries, whc are as follows: FIRSTLY: is it possible to access the controls(by name) of a parent form(MDI) from its child forms??if yes then how??plzz provide a coded example in VB if...
3
by: Robertf987 | last post by:
Well, I think I've described what I want to do in the title here. In the database, I have two main tables that contain the main data for the database. One for group expenditures, another for...
9
by: RvGrah | last post by:
I'm completely new to using background threading, though I have downloaded and run through several samples and understood how they worked. My question is: I have an app whose primary form...
1
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
7
by: Icarus | last post by:
I have a Access 2000 database that I am opening with Access 2007. When I open the datbase in Access 2000 or Access 2003, the database runs as expected. In Access 2007 my main form opens, a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.