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=registra tion.asp page. i will post my registration.as p page below.
I am hoping this asp page will connect to my access database called registration.md b 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
_______________ _______________ _______________ _______________ ___ - <%@ Language=VBScript %>
-
<% Option Explicit %>
-
<!--#include virtual="/adovbs.inc"-->
-
<html>
-
<body>
-
<%
-
Dim objConn
-
Set objConn = Server.CreateObject("ADODB.Connection")
-
objConn.ConnectionString="Driver={Microsoft Access Driver (*.mdb)};" & _
-
"DBQ=C:\Documents and Settings\MM\Desktop\Website\registration.mdb"
-
objConn.Open
-
-
Dim objRS, bolAlreadyExists
-
If ((Request.Form("firstname") = "") OR (Request.Form("lastname") = "") _
-
OR (Request.Form("street") = "") OR (Request.Form("city") = "") _
-
OR (Request.Form("state") = "") OR (Request.Form("zipcode") = "") _
-
OR (Request.Form("birthdate") = "") oR (Request.Form("email") = "") _
-
OR (Request.Form("confirmemail") = "") oR (Request.Form("password") = "") _
-
OR (Request.Form("confirmpassword") = "") oR (Request.Form("question") = "") _
-
OR (Request.Form("answer") = "") oR (Request.Form("confirmanswer") = "") _
-
OR (Request.Form("interest") = "") oR (Request.Form("nonewsemail") = "") _
-
OR (Request.Form("hearabout") = "")
-
-
Response.Write "<a href='registration.html'>"
-
Response.Write "You must enter values for all the fields."
-
Response.Write "</a>"
-
Else
-
bolAlreadyExists = False
-
Set objRS = Server.CreateObject("ADODB.Recordset")
-
objRS.Open "registration", objConn, , adLockOptimistic, adCmdTable
-
Do While Not (objRS.EOF OR bolAlreadyExists)
-
If (StrComp(objRS("email"), Request.Form("email"), _
-
vbTextCompare) = 0) Then
-
Response.Write "<a href='registration.html'>"
-
Response.Write "Email address already found in table."
-
Response.Write "</a>
-
bolAlreadyExists = True
-
End If
-
objRS.MoveNext
-
Loop
-
If Not bolAlreadyExists Then
-
-
objRS.AddNew
-
-
objRS("firstname") = Request.Form("firstname")
-
objRS("lastname") = Request.Form("lastname")
-
objRS("street") = Request.Form("street")
-
objRS("city") = Request.Form("city")
-
objRS("state") = Request.Form("state")
-
objRS("zipcode") = Request.Form("zipcode")
-
objRS("birthdate") = Request.Form("birthdate")
-
objRS("email") = Request.Form("email")
-
objRS("confirmemail") = Request.Form("confirmemail")
-
objRS("password") = Request.Form("password")
-
objRS("confirmpassword") = Request.Form("confirmpassword")
-
objRS("question") = Request.Form("question")
-
objRS("answer") = Request.Form("answer")
-
objRS("confirmanswer") = Request.Form("confirmanswer")
-
objRS("awardprogram") = Request.Form("awardprogram")
-
objRS("accountnumber") = Request.Form("accountnumber")
-
objRS("interest") = Request.Form("interest")
-
objRS("nonewsemail") = Request.Form("nonewsemail")
-
objRS("hearabout") = Request.Form("hearabout")
-
objRS.Update
-
Response.Write "Thank you for registering."
-
End If
-
objRS.Close
-
Set objRS = Nothing
-
End If
-
objConn.Close
-
Set objConn = Nothing
-
%>
-
</body>
-
</html>
Oct 28 '08
24 3692
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.as p code like this "</a>"", I receive the following error
****Microsoft VBScript compilation error '800a0409'
Unterminated string constant
/registration.as p, 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.as p, 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?
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.as p code like this "</a>"", I receive the following error
****Microsoft VBScript compilation error '800a0409'
Unterminated string constant
/registration.as p, 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.as p, 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:
Can you post the updated code in its entirety?
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.ds n. 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(Micr osoft Access Driver *.mdb), and i named this registration.ds n. 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.as p, line 10
____
here is my updated code. i have a hosting account with godaddy, would this cause the problem? - <%@ Language=VBScript %>
-
<% Option Explicit %>
-
<!--#include virtual="/adovbs.inc"-->
-
<html>
-
<body>
-
<%
-
Dim objConn
-
Set objConn = Server.CreateObject("ADODB.Connection")
-
objConn.ConnectionString = "DSN=registration.dsn"
-
objConn.Open
-
Dim objRS, bolAlreadyExists
-
If ((Request.Form("firstname") = "") OR (Request.Form("lastname") = "") _
-
OR (Request.Form("street") = "") OR (Request.Form("city") = "") _
-
OR (Request.Form("state") = "") OR (Request.Form("zipcode") = "") _
-
OR (Request.Form("birthdate") = "") OR (Request.Form("email") = "") _
-
OR (Request.Form("confirmemail") = "") OR (Request.Form("password") = "") _
-
OR (Request.Form("confirmpassword") = "") OR (Request.Form("question") = "") _
-
OR (Request.Form("answer") = "") OR (Request.Form("confirmanswer") = "") _
-
OR (Request.Form("interest") = "") OR (Request.Form("nonewsemail") = "")) Then
-
-
-
Response.Write "<a href='registration.html'>"
-
Response.Write "You must enter values for all the fields."
-
Response.Write "</a>"
-
Else
-
bolAlreadyExists = False
-
Set objRS = Server.CreateObject("ADODB.Recordset")
-
objRS.Open "registration", objConn, , adLockOptimistic, adCmdTable
-
Do While Not (objRS.EOF OR bolAlreadyExists)
-
If (StrComp(objRS("email"), Request.Form("email"), _
-
vbTextCompare) = 0) Then
-
Response.Write "<a href='registration.html'>"
-
Response.Write "Email address already found in table."
-
Response.Write "</a>"
-
bolAlreadyExists = True
-
End If
-
objRS.MoveNext
-
Loop
-
If Not bolAlreadyExists Then
-
-
objRS.AddNew
-
-
objRS("firstname") = Request.Form("firstname")
-
objRS("lastname") = Request.Form("lastname")
-
objRS("street") = Request.Form("street")
-
objRS("city") = Request.Form("city")
-
objRS("state") = Request.Form("state")
-
objRS("zipcode") = Request.Form("zipcode")
-
objRS("birthdate") = Request.Form("birthdate")
-
objRS("email") = Request.Form("email")
-
objRS("confirmemail") = Request.Form("confirmemail")
-
objRS("password") = Request.Form("password")
-
objRS("confirmpassword") = Request.Form("confirmpassword")
-
objRS("question") = Request.Form("question")
-
objRS("answer") = Request.Form("answer")
-
objRS("confirmanswer") = Request.Form("confirmanswer")
-
objRS("awardprogram") = Request.Form("awardprogram")
-
objRS("accountnumber") = Request.Form("accountnumber")
-
objRS("interest") = Request.Form("interest")
-
objRS("nonewsemail") = Request.Form("nonewsemail")
-
objRS("hearabout") = Request.Form("hearabout")
-
objRS.Update
-
Response.Write "Thank you for registering."
-
End If
-
objRS.Close
-
Set objRS = Nothing
-
End If
-
objConn.Close
-
Set objConn = Nothing
-
%>
-
</body>
-
</html>
jhardman 3,406
Recognized Expert Specialist
try: -
objConn.ConnectionString = "DSN=registration"
-
Hi, thanks for you thoughts. However, using "DSN=registrati on" 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.as p, line 10
jhardman 3,406
Recognized Expert Specialist
What kind of database are you using? and did you actually make the DSN?
Jared
hello, I am using a Microsoft Access database called registration.md b 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.ds n.
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? - <%
-
Dim oConn, oRs
-
Dim qry, connectstr
-
Dim db_path
-
Dim db_dir
-
db_dir = Server.MapPath("access_db") & "\"
-
db_path = db_dir & "yourdatabasefile.mdb"
-
fieldname = "your_field"
-
tablename = "your_table"
-
-
connectstr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & db_path
-
-
Set oConn = Server.CreateObject("ADODB.Connection")
-
oConn.Open connectstr
-
qry = "SELECT * FROM " & tablename
-
-
Set oRS = oConn.Execute(qry)
-
-
if not oRS.EOF then
-
while not oRS.EOF
-
response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & "
-
"
-
oRS.movenext
-
wend
-
oRS.close
-
end if
-
-
Set oRs = nothing
-
Set oConn = nothing
-
-
%>
hello, I am using a Microsoft Access database called registration.md b 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.ds n.
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? - <%
-
Dim oConn, oRs
-
Dim qry, connectstr
-
Dim db_path
-
Dim db_dir
-
db_dir = Server.MapPath("access_db") & "\"
-
db_path = db_dir & "yourdatabasefile.mdb"
-
fieldname = "your_field"
-
tablename = "your_table"
-
-
connectstr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & db_path
-
-
Set oConn = Server.CreateObject("ADODB.Connection")
-
oConn.Open connectstr
-
qry = "SELECT * FROM " & tablename
-
-
Set oRS = oConn.Execute(qry)
-
-
if not oRS.EOF then
-
while not oRS.EOF
-
response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & "
-
"
-
oRS.movenext
-
wend
-
oRS.close
-
end if
-
-
Set oRs = nothing
-
Set oConn = nothing
-
-
%>
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.
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.
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: - SELECT field FROM table WHERE ID = 1
Then just write out that one value with: Sign in to post your reply or Sign up for a free account.
Similar topics |
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 *what the user
wants*. I've had brief formal education about data flow diagramming,
but I'm looking for ... more, now that I'm actually running into
problems I think stem from the fact that my users can't explain what
they need done, compounded by...
|
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 trying to perform the replacement by using an external MS Access
program that contains the replacement form also called FO-008. I need
to keep the same form name since the form contains relationships to
other forms and quarries in the program.
...
|
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 browse/add one
picture at a time to a system. Now he would like to 'view' all of the
thumbnails associated with any system on a single form.
I can setup a main/subform scenario, but how do I show all of the
pictures as thumbnails. I was using the...
|
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 (called: myform) in which there is a combo (combo1) and a
button (button1). In properties for combo1, I use "Value List" for Row
Source Type and in Row Source : "0000-0999";"1000-1999". So when the
form first load, in the combo1, there are 2 values in...
|
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 possible..
for example..i hav a menu in the parent form named "Administrator" whic
has an item "mnuLogIn"..now when i click on login..another child form
named "frmLogIn" is displayed..what i want to happen is this:
when login form(frmLogIn) is...
| |
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 application details. I have a query for each of them to copy all the contents of the table into a new table, then delete all the data from the main table. I need to do this becasue once a year the data needs to be removed, ready for putting in new data. I...
|
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 will almost always lead to the user
opening a certain child window that's fairly resource intensive to
load. Is it possible to load this form in a backgroundworker and then
use the Show method and hide method as necessary? Anyone know of
|
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 are not bound, I select from the bottom set and add to the top set which works fine, but now i decide to remove an item from the top set.
when i tried to use a remove item code it worked fine, it did delete the item form the list but it added...
|
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 form with multiple tabs and
subforms, the form now takes a "very" long time (more than 10 minutes)
to load.
Has anyone come across this before, and if so were you able to fix it?
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |