Cannot add more than one field to a new record

Results 1 to 5 of 5

Thread: Cannot add more than one field to a new record

  1. #1
    Shamsan Guest

    Default Cannot add more than one field to a new record

    I have the following lines in ASP files that stores fields from INDEX.HTM (the caller of this ASP) into variable.<BR><BR>It allow me to add only one record to the database, i.e, when I try to add both name and memo to the database I get an error message and I cannot append to database<BR><BR>What shall I do to add more than one field ?<BR><BR>-----------<BR>ADD.ASP<BR>&#039Store the variable to name. txtnameadd is the text box in index.htm<BR>&#039Request.form function request the value from the form.<BR>name = server.HtmlEncode(request.form("txtnameadd")) <BR>memo = server.HtmlEncode(request.form("memoadd")) <BR><BR>&#039Add a blank record<BR>Rs.addnew<BR><BR>&#039Store name to <BR>Rs("name") = name<BR>Rs("memo") = memo<BR>Rs.update<BR><BR>-------------

  2. #2
    Join Date
    Dec 1969

    Default RE: Cannot add more than one field to a new record

    Just a guess but you have the field memoadd in your database and your code is telling it to update the field "memo" which is not in your table. Try changing your code to this and see what happens.<BR><BR>Rs("memoadd") = memo<BR>

  3. #3
    Shamsan Guest

    Default RE: Cannot add more than one field to a new record

    No the name of the field is correct which is &#039memo&#039. <BR>Actually if I add only one field (memo) it works find, i.e, I can add to memo field but when but both variables &#039name&#039 and &#039memo&#039 together in one ASP to update file using the command<BR>&#039Add a blank record<BR>Rs.addnew<BR><BR>&#039Store name to <BR>Rs("name") = name<BR>Rs("Memo") = memo<BR>Rs.update<BR><BR>I get the following error messagge, that memo field is zero-length where there is data entered:<BR><BR>Microsoft JET Database Engine error &#039 80040e21&#039 <BR><BR>Field &#039users.Memo&#039 cannot be a zero-length string. <BR><BR>/add.asp, line 33 <BR>

  4. #4
    troy the asp boy Guest

    Default 2 quick things

    2 suggestions.<BR><BR>If you are using Access as your database go to the Table Field Properties and click on the data type for the variable. It should say memo. Now look down and see if "Allow Zero Length" field is Yes or No. Changing it from No to Yes. This will probably fix the problem.<BR><BR>Also, I personally try to avoid naming my fields with reserved words. IE: name the field custMemo instead of Memo. Sometimes this helps you avoid naming issues.<BR><BR>cheers<BR>troy the asp boy <BR>

  5. #5
    Shamsan Guest

    Default RE: 2 quick things

    Thanks troy the asp boy,<BR>Acutally I solved the problem by checking my &#060;form&#062; & &#060;/form&#062;<BR>and included both variables in the form. Now it&#039s OK.<BR><BR>I know I did a stupid mistake in the year 2000 !!<BR><BR>Cheers,<BR>Shamsan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts