Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 19th, 2004, 09:55 PM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Weird Errors

I need your help.

The error message:

Database Results Error
Description: [Microsoft][ODBC Microsoft Access Driver] Field 'Appointment.UserID' cannot be a zero-length string.
Number: -2147467259 (0x80004005)
Source: Microsoft OLE DB Provider for ODBC Drivers

One or more form fields were empty. You should provide default values for all form fields that are used in the query.


The code:

<%@ LANGUAGE="VBSCRIPT" %>

<html>

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

<body>
<%
Dim UserID, PropertyID, Day, Time
UserID = Session("UserID")
PropertyID = Request.Form("PropertyID")
Day = Request.Form("Day")
Time = Request.Form("Time")

Response.Write UserID
Response.Write PropertyID
Response.Write Day
Response.Write Time
%>

<table>
  <tbody>
    <!--webbot bot="DatabaseRegionStart" startspan s-columnnames s-columntypes
    s-dataconnection="RealWebDB" b-tableformat="TRUE" b-menuformat="FALSE"
    s-menuchoice s-menuvalue b-tableborder="FALSE" b-tableexpand="FALSE"
    b-tableheader="FALSE" b-listlabels="TRUE" b-listseparator="TRUE"
    i-ListFormat="0" b-makeform="FALSE" s-recordsource s-displaycolumns
    s-criteria s-order
    s-sql="INSERT INTO Appointment (AgentID, UserID, PropertyID, PrefDay, PrefTime)<br>SELECT AgentID, '::UserID::', ::PropertyID::, '::Day::', '::Time::'<br>FROM Property<br>WHERE PropertyID = ::PropertyID::"
    b-procedure="FALSE" clientside SuggestedExt="asp"
    s-DefaultFields="UserID=&amp;PropertyID=&amp;Day=&am p;Time=&amp;PropertyID="
    s-NoRecordsFound="No records returned." i-MaxRecords="256" i-GroupSize="0"
    BOTID="0" u-dblib="../../_fpclass/fpdblib.inc"
    u-dbrgn1="../../_fpclass/fpdbrgn1.inc"
    u-dbrgn2="../../_fpclass/fpdbrgn2.inc" tag="TBODY"
    local_preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; align=&quot;left&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;Database Results regions will not preview unless this page is fetched from a Web server with a web browser. The following table row will repeat once for every record returned by the query.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;"
    preview="<tr><td colspan=64 bgcolor=&quot;#FFFF00&quot; align=&quot;left&quot; width=&quot;100%&quot;>This is the start of a Database Results region.</td></tr>" b-WasTableFormat="TRUE" -->

<%
fp_sQry="INSERT INTO Appointment (AgentID, UserID, PropertyID, PrefDay, PrefTime) SELECT AgentID, '::UserID::', ::PropertyID::, '::Day::', '::Time::' FROM Property WHERE PropertyID = ::PropertyID::"

fp_sDefault="UserID=&PropertyID=&Day=&Time=&Proper tyID="
fp_sNoRecords="<tr><td colspan=16 align=left width=""100%"">No records returned.</td></tr>"
fp_sDataConn="RealWebDB"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_iDisplayCols=16
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>



    <!--webbot bot="DatabaseRegionEnd" startspan b-tableformat="TRUE"
    b-menuformat="FALSE" u-dbrgn2="../../_fpclass/fpdbrgn2.inc"
    i-groupsize="0" clientside tag="TBODY"
    local_preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; align=&quot;left&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the end of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;"
    preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; align=&quot;left&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the end of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" -->

  </tbody>
</table>

</body>

</html>

What i don't get is, "Response.Write" for "UserID" works perfectly, along with the "Response.Write" statements for "Day" and "Time" (i.e. they display the variables' contents).

However, "Date" and "Time" does not encounter errors during insertion, unlike "UserID".

What could be the probelm?
 
Old April 21st, 2004, 05:56 PM
Authorized User
 
Join Date: Jan 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That field (userID) maybe set in your database to where there HAS to be something put in that field...I don't konw what kind you are using, but in MS Access, if you go into design view, there are properties you can set for each field....maybe that's the problem?

 
Old April 24th, 2004, 12:10 PM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, there has to be something for the data value. This can be set as I am using MS Access. But the problem remains:

There IS a data value provided thru the ASP script.

The "Response.Write" method shows that UserID holds a value, but it just isn't saved to the database like the other variables. So why am I still getting an "empty form field" message? Why isn't the data saved to the database?

 
Old April 25th, 2004, 04:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Did you try this way?

Print the fp_sQry or s-sql string using response.write and copy the output, run the same in your MSAccess db and see if that succeeds. If that doesn't succeed, then you got to re-look into your code.

Cheers!

-Vijay G





Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird search panossss PHP How-To 1 February 21st, 2008 06:41 AM
Weird Build Errors Aaron Edwards ASP.NET 2.0 Basics 1 November 2nd, 2007 03:04 AM
Can't get errors to display with <html:errors> michaeldill JSP Basics 0 August 2nd, 2004 01:47 PM
errors and fixing errors Droopy XML 0 August 26th, 2003 12:47 AM
Errors Errors DB Errors Ljhopkins VS.NET 2002/2003 0 July 15th, 2003 12:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.