•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 374,457 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,778 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 15146 | Replies: 31
![]() |
•
•
Join Date: Jun 2005
Location: Denmark, EU
Posts: 102
Reputation:
Rep Power: 4
Solved Threads: 3
•
•
•
•
First step: Create the questionnaire in html.
Second step: Write the code in ASP to get information back from client.
Third Step: Create a table in Access to capture the feedback sent back from the client. This table consists of six columns which include the names( reason,response,rate,resolved and comments), and primary key. Fourth: Write the code in ASP to read and write information from questionnaire to the table.
Fifth: Task Complete.
Does this sound like the steps needed to complete this task.
•
•
•
•
(1)Question: The database name for the statement below would that be Microsoft Access, the file name of the table or something else? Or is it the name you give when you set up the DSN?
Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("database_name.mdb")
(2)Question: How do you know which method to use or have to use between OLE DB or ODBC to connect to a database?
(3)Question: When I try to create the DSN, when I decide to Windows NT authentication or SQL server, either way I receive an error connection failed, any ideas why? I am using Windows XP professional.
(1)The "database_name" in the statement is the name of the actual Access database file (notice the extension). If you place your database file in a folder other that the one holding your asp files, folder names should be included here as well (eg. ("workdir/data/database_name.mdb") ).
(2) I'm not sure I even know that, but I guess it's database dependent.
(3) Don't think I understand the question. The connection string object used in the previously posted code is a non-DSN connection. There should no need to setup additional things to make it run.
I never use DSN connections my self, so I'm not that familiar with it.
If you want to use a DSN connection you can setup a user DSN on your computer through Control Panel -> Administrative Tools -> Data Sources (ODBC)
And then smth like (adoCon.Open "DSN=name_of_your_dsn_connection") should suffice as your connection object string.
Or you can always try Google (Google is our friend :cheesy: ) or maybe http://www.iisanswers.com
I keep getting an error message. This is the error message I keep receiving when trying to submit the questionnaire. I also placed the code for the asp part of the questionnaire again below. My access file is in a folder named eLMS Table 1 and the file name is eLMS Database Table.
Error Type: Microsoft VBScript compilation (0x800A0411) Name redefined /eLMS/processform.asp, line 108, column 4 Dim adoCon <!--Holds the Database Connection Object--> ---^ Browser Type: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Page: POST 131 bytes to /eLMS/processform.asp POST Data: reason=Unable+to+login+to+eLMS&response=They+did+not+reply+to+my+e-mail&resolved=No&rate=Very+Satisfied&comments=What&action=SUBMIT Time: Tuesday, August 23, 2005, 10:53:35 AM More information: Microsoft Support
<html>
<head>
<body>
<title>
eLMS Feedback Form Process
</title>
<body bgcolor = "white">
<hr>
<h1>
eLMS Survey
</h1>
<blockquote>
<b> Reason for contacting:</b> <%=Request.Form("reason")%> <br><br>
<b> Response Time:</b> <%=Request.Form("response")%> <br><br>
<b> Issue Resolved:</b> <%=Request.Form("resolved")%> <br><br>
<b> Rate Service:</b> <%=Request.Form("rate")%> <br><br>
<b> Comments: </b> <%=Request.Form("comments")%> <br><br><br>
</blockquote>
<!--The following code writes data to the Microsoft Access database -->
<%
<!--DIMENSION VARIABLES-->
Dim adoCon <!-- HOLDS THE DATABASE CONNECTION OBJECT-->
Dim strSQL <!-- HOLDS THE SQL QUERY FOR THE DATABASE-->
Set adoCon = Server.CreateObject("ADODB.Connection")
<!-- SET AN ACTIVE CONNECTION TO THE CONNECTION OBJECT-->
adoCon.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=C:\eLMS Table 1\eLMS Database Table " & Server.MapPath("eLMS Table 1\eLMS Database Table.mdb")
<!--the "blank" data value ( '' ) is intented for an "auto value" field like and id auto increment column.-->
<!--Using this method the number of values in the strSQL string must be the same as the number of columns in the table.-->
<!--Initialize the strSQL variable with an SQL statement to query the database-->
strSQL = "INSERT INTO eLMS Table 1 VALUES('', '" & Request.Form("reason") & "', '" & Request.Form("response") & "', '" & Request.Form("resolved") & "', '" & Request.Form("rate") & "', '" & Request.Form("comments") & "');"
<!--insert new data into table-->
adoCon.Execute strSQL
<!--Reset server objects-->
Set adoCon = Nothing
<!--Redirect to some page -->
Response.Redirect " thanks.htm"
%>
<!--The end of the code for writing to the Microsoft Access Database-->
<!--The following code is for reading data from the Microsoft Access Database file-->
<%
<!--Dimension variables-->
Dim adoCon <!--Holds the Database Connection Object-->
Dim rsData <!--Holds the recordset for the new record to be added to the database-->
Dim strSQL <!--Holds the SQL query for the database-->
Set adoCon = Server.CreateObject("ADODB.Connection")
<!--Set an active connection to the Connection object-->
adoCon.Open " PROVIDER=MICROSOFT.Jet.OLEDB.4.0;DATA SOURCE=C:\eLMS Table 1" & Server.MapPath("eLMS Table 1\eLMS Database Table.mdb")
<!--Create an ADO recordset object-->
Set rsData = Server.CreateObject("ADODB.Recordset")
<!-- Initialize the strSQL variable with an SQL statement to query the database-->
strSQL = "SELECT * FROM BloomerDatabase; " <!-- Name of the system ODBC that I created -->
<!-- Open the table using the SQL query held in the strSQL variable-->
rsData.Open strSQL, adoCon
<!-- Loop through recordset lines-->
Do While Not rsData.EOF
<!--Output-->
Response.Write rsData("reason") & " - " & rsData("response") & " - " & rsData("resolved") & " - " & rsData("rate") & " - " & rsData("comments") & "<BR>"
<!-- Move to next record-->
rsData.MoveNext
Loop
<!--Reset server objects-->
rsData.Close
Set rsData = Nothing
Set adoCon = Nothing
%>
<!-- End of code for reading from Microsoft Access Database Table -->
</body>
</html>
</head>
I deleted the code for reading from the database. I don't think I need that part of the code in their for reading to a database since I am only writing to the access database. Now this is the error message below:
Technical Information (for support personnel) Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Microsoft Access Driver] Not a valid file name. /eLMS/processform.asp, line 67 Browser Type: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Page: POST 161 bytes to /eLMS/processform.asp POST Data: reason=Received+e-mail+message+concerning+Learning+Expiration+Notification&response=2+-+6+hours&resolved=No&rate=Extremely+unsatisfied&comments=vvv&action=SUBMIT Time: Tuesday, August 23, 2005, 1:26:17 PM More information: Microsoft Support
•
•
Join Date: Jun 2005
Location: Denmark, EU
Posts: 102
Reputation:
Rep Power: 4
Solved Threads: 3
•
•
•
•
Error Type:
Microsoft VBScript compilation (0x800A0411)
Name redefined
/eLMS/processform.asp, line 108, column 4
Dim adoCon <!--Holds the Database Connection Object-->
---^
You've dimensioned the variable both in the read and write part of the code. Only dimension variables once.
As for
•
•
•
•
[Microsoft][ODBC Microsoft Access Driver] Not a valid file name.
/eLMS/processform.asp, line 67
It should only be
•
•
•
•
Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("eLMS Table 1\eLMS Database Table.mdb")
This is the error message I am receiving now. Someone told me to check to make sure that they have permission for that folder. So I went to the inetpub and elms folders and allowed web sharing for those folders but still received same error message. I am going to keep at it. I posted the error code and html/asp code below.
This is the error code.
This is the ASP code.
This is the error code.
HTTP 500.100 - Internal Server Error - ASP error Internet Information Services -------------------------------------------------------------------------------- Technical Information (for support personnel) Error Type: Microsoft JET Database Engine (0x80004005) 'C:\Inetpub\wwwroot\eLMS\eLMS Table 1\eLMS Database Table.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides. /eLMS/processform.asp, line 65 Browser Type: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Page: POST 156 bytes to /eLMS/processform.asp POST Data: reason=Received+e-mail+message+concerning+Learning+Expiration+Notification&response=6+-+12+hours&resolved=No&rate=Satisfied&comments=tuyjtyujt&action=SUBMIT Time: Thursday, August 25, 2005, 11:49:15 AM More information: Microsoft Support
This is the ASP code.
<html>
<head>
<body>
<title>
eLMS Feedback Form Process
</title>
<body bgcolor = "white">
<hr>
<h1>
eLMS Survey
</h1>
<blockquote>
<b> Reason for contacting:</b> <%=Request.Form("reason")%> <br><br>
<b> Response Time:</b> <%=Request.Form("response")%> <br><br>
<b> Issue Resolved:</b> <%=Request.Form("resolved")%> <br><br>
<b> Rate Service:</b> <%=Request.Form("rate")%> <br><br>
<b> Comments: </b> <%=Request.Form("comments")%> <br><br><br>
</blockquote>
<!-- The following code writes data to the Microsoft Access database -->
<%
<!--DIMENSION VARIABLES-->
Dim adoCon <!-- HOLDS THE DATABASE CONNECTION OBJECT-->
Dim strSQL <!-- HOLDS THE SQL QUERY FOR THE DATABASE-->
Set adoCon = Server.CreateObject("ADODB.Connection")
<!-- SET AN ACTIVE CONNECTION TO THE CONNECTION OBJECT-->
adoCon.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("eLMS Table 1\eLMS Database Table.mdb")
<!-- adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\eLMS Table 1\eLMS Database Table" & Server.MapPath("eLMS Table 1\eLMS Database Table.mdb") -->
<!--the "blank" data value ( '' ) is intented for an "auto value" field like and id auto increment column.-->
<!--Using this method the number of values in the strSQL string must be the same as the number of columns in the table.-->
<!--Initialize the strSQL variable with an SQL statement to query the database-->
strSQL = "INSERT INTO eLMS Table 1 VALUES('', '" & Request.Form("reason") & "', '" & Request.Form("response") & "', '" & Request.Form("resolved") & "', '" & Request.Form("rate") & "', '" & Request.Form("comments") & "');"
<!--insert new data into table-->
adoCon.Execute strSQL
<!--Reset server objects-->
Set adoCon = Nothing
<!--Redirect to some page -->
Response.Redirect " thanks.htm"
%>
<!--The end of the code for writing to the Microsoft Access Database-->
</body>
</html>
</head>
I created a new table in access and stored the file eLMSTable in the inetpub/wwwroot folder (inetpub/wwwroot/eLMSTable) and this is the error message I am receiving now. Doesn't seem like I have a connection error but a problem accessing the table. Not sure.
This is the error message.
This is the asp code here:
This is the error message.
HTTP 500.100 - Internal Server Error - ASP error Internet Information Services -------------------------------------------------------------------------------- Technical Information (for support personnel) Error Type: Microsoft JET Database Engine (0x80040E37) Could not find output table 'eLMS'. /eLMS/processform.asp, line 83 Browser Type: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Page: POST 123 bytes to /eLMS/processform.asp POST Data: reason=Course+progress+is+not+being+saved&response=1+business+day&resolved=No&rate=Satisfied&comments=gbdfbgf&action=SUBMIT Time: Thursday, August 25, 2005, 4:28:28 PM More information: Microsoft Support
This is the asp code here:
<html>
<head>
<body>
<title>
eLMS Feedback Form Process
</title>
<body bgcolor = "white">
<hr>
<h1>
eLMS Survey
</h1>
<blockquote>
<b> Reason for contacting:</b> <%=Request.Form("reason")%> <br><br>
<b> Response Time:</b> <%=Request.Form("response")%> <br><br>
<b> Issue Resolved:</b> <%=Request.Form("resolved")%> <br><br>
<b> Rate Service:</b> <%=Request.Form("rate")%> <br><br>
<b> Comments: </b> <%=Request.Form("comments")%> <br><br><br>
</blockquote>
<!-- The following code writes data to the Microsoft Access database -->
<%
<!--DIMENSION VARIABLES-->
Dim adoCon <!-- HOLDS THE DATABASE CONNECTION OBJECT-->
Dim strSQL <!-- HOLDS THE SQL QUERY FOR THE DATABASE-->
Set adoCon = Server.CreateObject("ADODB.Connection")
<!-- SET AN ACTIVE CONNECTION TO THE CONNECTION OBJECT-->
adoCon.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("eLMSTable.mdb")
<!-- adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\eLMS Table 1\eLMS Database Table" & Server.MapPath("eLMS Table 1\eLMS Database Table.mdb") -->
<!--the "blank" data value ( '' ) is intented for an "auto value" field like and id auto increment column.-->
<!--Using this method the number of values in the strSQL string must be the same as the number of columns in the table.-->
<!--Initialize the strSQL variable with an SQL statement to query the database-->
strSQL = "INSERT INTO eLMS VALUES('', '" & Request.Form("reason") & "', '" & Request.Form("response") & "', '" & Request.Form("resolved") & "', '" & Request.Form("rate") & "', '" & Request.Form("comments") & "');"
<!--insert new data into table-->
adoCon.Execute strSQL
<!--Reset server objects-->
Set adoCon = Nothing
<!--Redirect to some page -->
Response.Redirect " thanks.htm"
%>
<!--The end of the code for writing to the Microsoft Access Database-->
<!--The following code is for reading data from the Microsoft Access Database file-->
<%
<!--Dimension variables-->
Dim rsData <!--Holds the recordset for the new record to be added to the database-->
Set adoCon = Server.CreateObject("ADODB.Connection")
<!--Set an active connection to the Connection object-->
adoCon.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("eLMSTable.mdb")
<!-- adoCon.Open " PROVIDER=MICROSOFT.Jet.OLEDB.4.0;DATA SOURCE=C:\eLMS Table 1" & Server.MapPath("eLMS Table 1\eLMS Database Table.mdb") -->
<!--Create an ADO recordset object-->
Set rsData = Server.CreateObject("ADODB.Recordset")
<!-- Initialize the strSQL variable with an SQL statement to query the database-->
strSQL = "SELECT * FROM BloomerDatabase; " <!-- Name of the system ODBC that I created -->
<!-- Open the table using the SQL query held in the strSQL variable-->
rsData.Open strSQL, adoCon
<!-- Loop through recordset lines-->
Do While Not rsData.EOF
<!--Output-->
Response.Write rsData("reason") & " - " & rsData("response") & " - " & rsData("resolved") & " - " & rsData("rate") & " - " & rsData("comments") & "<BR>"
<!-- Move to next record-->
rsData.MoveNext
Loop
<!--Reset server objects-->
rsData.Close
Set rsData = Nothing
Set adoCon = Nothing
%>
<!-- End of code for reading from Microsoft Access Database Table -->
</body>
</html>
</head>
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb ASP Marketplace
Other Threads in the ASP Forum
- Previous Thread: ASP Loop Query
- Next Thread: News Scroller - Pls help !!


It works now. Had to do with path with the access table I created.
when it FINALLY works, right?
Linear Mode