Solved

Getting code error when trying to run .asp page from FrontPage 2002

Posted on 2004-03-22
11
347 Views
Last Modified: 2013-12-24
I am trying to link a access database from Frontpage 2002. I went through the database wizard in Frontpage and it created 2 pages. One was called submission_form.asp and the other is results_page.asp. I created the database to contain three fields. Customer, Unit and History. When run the results_page.asp it comes up with no records. The database started with no records so I went into access and added one to test it. When I ran the results_page.asp after putting the data in the database it still didn't show any records. When I hit Preview in Browser on the submission_form.asp it gave me the following code instead of a page with the fields on it:
<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.

On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1252
Err.Clear

strErrorUrl = ""

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
      Err.Clear

      Set fp_conn =  Server.CreateObject("ADODB.Connection")
      FP_DumpError strErrorUrl, "Cannot create connection"

      Set fp_rs = Server.CreateObject("ADODB.Recordset")
      FP_DumpError strErrorUrl, "Cannot create record set"

      fp_conn.Open Application("production_ConnectionString")
      FP_DumpError strErrorUrl, "Cannot open database"

      fp_rs.Open "Results", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
      FP_DumpError strErrorUrl, "Cannot open record set"

      fp_rs.AddNew
      FP_DumpError strErrorUrl, "Cannot add new record set to the database"
      Dim arFormFields0(3)
      Dim arFormDBFields0(3)
      Dim arFormValues0(3)

      arFormFields0(0) = "Company"
      arFormDBFields0(0) = "Company"
      arFormValues0(0) = Request("Company")
      arFormFields0(1) = "Unit"
      arFormDBFields0(1) = "Unit"
      arFormValues0(1) = Request("Unit")
      arFormFields0(2) = "History"
      arFormDBFields0(2) = "History"
      arFormValues0(2) = Request("History")

      FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0


      fp_rs.Update
      FP_DumpError strErrorUrl, "Cannot update the database"

      fp_rs.Close
      fp_conn.Close

      FP_FormConfirmationFromArrays "text/html; charset=windows-1252",_
                                    "Form Confirmation",_
                                    "Thank you for submitting the following information:",_
                                    "submission_form.asp",_
                                    "Return to the form.",_
                                    arFormDBFields0,_
                                    arFormValues0

End If
End If

Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")

%>
<% Response.Buffer = True %>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Results -- New</title>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>

<body bgcolor="#FFFFFF">

<table width="100%" align=left>
  <tr>
    <td width="50%">
        <b><font size=+3 color="#000080"> Submission Form </font></b>
      </td>
    <td width="50%" align=right>
      <table>
        <tr>
          <td>
            <a href="results_page.asp" target="_top">Results Page</a> |
Submission Form

          </td>
        </tr>
      </table>
      </td>
  </tr>
</table>


<p>
<br clear="all">
<hr>
<p>

<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="JavaScript" Type="text/javascript"><!--
function FrontPage_Form1_Validator(theForm)
{

  if (theForm.Company.value.length > 255)
  {
    alert("Please enter at most 255 characters in the \"Company\" field.");
    theForm.Company.focus();
    return (false);
  }

  if (theForm.Unit.value.length > 5)
  {
    alert("Please enter at most 5 characters in the \"Unit\" field.");
    theForm.Unit.focus();
    return (false);
  }

  var checkOK = "0123456789-";
  var checkStr = theForm.Unit.value;
  var allValid = true;
  var validGroups = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only digit characters in the \"Unit\" field.");
    theForm.Unit.focus();
    return (false);
  }

  if (theForm.History.value.length > 255)
  {
    alert("Please enter at most 255 characters in the \"History\" field.");
    theForm.History.focus();
    return (false);
  }
  return (true);
}
//--></script><!--webbot BOT="GeneratedScript" endspan --><form METHOD="POST" action="submission_form.asp" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1" webbot-action="--WEBBOT-SELF--">

<!--webbot bot="SaveDatabase" suggestedext="asp" s-dataconnection="production" s-recordsource="Results" s-form-fields="Company Unit History" s-form-dbfields="Company Unit History " b-usedbfieldsforconfirmation="True" u-asp-include-url="../../_fpclass/fpdbform.inc" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include file="../../_fpclass/fpdbform.inc"--><!--webbot bot="SaveDatabase" endspan i-checksum="43152" -->

<p><b>Company</b><br>
&nbsp;<!--webbot bot="Validation" s-display-name="Company" s-data-type="String" b-value-required="False" i-maximum-length="255" --><input type="TEXT" name="Company" size="64" value="" maxlength="255"><br>
</p>
<p><b>Unit</b><br>
&nbsp;<!--webbot bot="Validation" s-display-name="Unit" s-data-type="Integer" b-value-required="False" i-maximum-length="5" --><textarea rows="10" name="Unit" cols="5"></textarea><br>
</p>
<p><b>History</b><br>
&nbsp;<!--webbot bot="Validation" s-display-name="History" s-data-type="String" b-value-required="False" i-maximum-length="255" --><input type="TEXT" name="History" size="64" value="" maxlength="255"><br>
</p>


<p><input type="submit" value="    OK    "><input type="reset" value=" Reset "></p>

</form>

</body>

</html>



Can anyone help me with this and tell me what I could be doing wrong. I am running XP pro and ran it from myweb in My Documents. I also tried moving it to a server we have setup on the network. I put it to \\server\inetpub\wwwroot\production. The server is running Windows 2000 Server and I set up and ODBC account linking to the database in the production folder. I really need some help getting this running. If anyone knows an easier way to do this I will be open to suggestions. Ive read the asp wizard stuff on Microsoft.com and numberous files on asp and they all go through the same steps that end up with the same results.
Thanks,
Josh Enochs
0
Comment
Question by:enochstek
  • 6
  • 5
11 Comments
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
>>I am running XP pro and ran it from myweb in My Documents.
When you're using ASP, you need to run it through IIS - which needs to be installed on your PC. (Let me know if it isn't)

So - the site needs to be either in C:/inetpub/wwwroot/submission_form.asp. or in a subweb C:/inetpub/wwwroot/myweb/submission_form.asp

Then, you open the site in the browser using this:

http://localhost/submission_form.asp - or in the second case, http://localhost/myweb/submission_form.asp

You can't run the asp pages using C://My Documents/myweb, because the code needs to use the asp engine in IIS.

Let me know...

Thanks,
Sean
0
 

Author Comment

by:enochstek
Comment Utility
I also tried running it off the server which has IIS installed and it did the same thing.
Josh Enochs
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
>>The server is running Windows 2000 Server and I set up and ODBC account linking to the database in the production folder.

The code above states:
fp_conn.Open Application("production_ConnectionString")

which FrontPage normally defines in the global.asa file in the root of the site. If you have created a new connection to the db, then you need to make sure your code recognizes it.

When you open the live site on the server, and go to Tools > Web Settings > Database, what happens when you verify the connection?
0
 

Author Comment

by:enochstek
Comment Utility
Ok, When I open frontpage on my XP Pro machine and then go to File - Open and point it to the Web5 that is on the Server in inetpub\wwwroot\production and verify the connection it verifies it and puts a green checkmark next to it.
0
 

Author Comment

by:enochstek
Comment Utility
Ok Seanpowell,
I got home and put the Myweb (which contained the forms and my database) folder into \inetpub\wwwroot and changed my database path to use that database and I verified it. It checked ok and was verified. I then went to http:\\localhost\index.htm and it brought up my index page. i then clicked on the submissions form link and it brought up the submission form and not asp code which is right but then when I typed in data in the three fields and hit submit it said thank you for submitting like it had worked, but then when I go to the database, the data that I entered isn't there?!?!? Any idea why it didn't update it?
Thanks,
Josh Enochs
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 31

Accepted Solution

by:
seanpowell earned 500 total points
Comment Utility
Sorry Josh, had an emergency yesterday...
This may be a permission issue - or just a naming one.

Can you have a look through this?
http://support.microsoft.com/default.aspx?scid=kb;EN-US;219158



0
 

Author Comment

by:enochstek
Comment Utility
Sean,
I looked at the link you sent me and I have been through that a few times already. I think I have got a problem with asp or something. When I publish my webpage to the server it says that asp is not supported on the server I am publishing to so the three pages will not work properly. But I am running Server 2000 with IIS 5.0. Do you know what would cause this?
0
 

Author Comment

by:enochstek
Comment Utility
Sean,
I got it to update the database now. It was because the frontpage extensions were #@!#@ up. I reinstalled it on the server and it worked. Now I am getting another problem though. When I go to the Form Properties on my Submission.asp page to change what field the text box is linked to I click on Options to go in and change it and where it says what database connection to use it has my database name and it says connecting to database and then gives me this error:

Server error: Unable to retrieve the list of record sources from a database using the connection string:

DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/production.mdb.

The following error message comes from the database driver software; it may appear in a different language depending on how the driver is configured.
-------------------------------------------------------


Source: ADO
Number: -2146824584 (0x800a0e78)
Do you know what this is?
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
Were you using a username and passowrd for the db?
0
 

Author Comment

by:enochstek
Comment Utility
Nevermind! I feel so stupid! It was because I was in the database on another pc. Thanks for your help!
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
Hey - you wouldn't believe some of the things I've done. I can't even mention them here...

I'm so happy you're back on track :-)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now