Update problems

Results 1 to 4 of 4

Thread: Update problems

  1. #1
    K. St-Louis Guest

    Default Update problems

    I&#039m new to ASP and have what seems to me a simple question, but it&#039s giving me fits!<BR><BR>Lets day I have three fields in my record Text1, Text2, Text3 and Text4 and an ID.<BR><BR>I have given the user the ability to update this record via a form. The user may need to enter only some of the field (i.e. Text1 and Text3). Meaning some may be empty. When I try to do my update I get a zero-length error for the fields they have not entered data in.<BR><BR>How can I avoid this? I must be over looking something......<BR><BR>kstlouis

  2. #2
    Join Date
    Dec 1969

    Default RE: Update problems

    Look at the "Allow zero-length" properties for the fields1, 2 and 3 in your database. It should be set to "Yes". Also make sure these fiels are not indexed.

  3. #3
    Sarina Guest

    Default RE: Update problems

    If you allow zero lengths though, won&#039t it assume you want to update the value of the field to "nothing" if you have a blank form field in an Update query?<BR><BR>I&#039ve been doing something a little messy, but it works. I&#039ve been using if/then statements to find null form fields, and running the sql statement based on the results. <BR><BR>e.g., you have form fields text1, text2, text3 and table fields Text1, Text2, Text3<BR><BR>ObjSQL="Update Table Set "(<BR>If text1="" Then<BR>ObjSQL=ObjSQL<BR>Else<BR>ObjSQL=ObjSQL & text1 & ")"<BR>End if<BR><BR>&#039Then for the values to input:<BR><BR>ObjSQL=ObjSQL & "Value("<BR>If text1="" Then<BR>ObjSQL=ObjSQL<BR>Else<BR>ObjSQL=ObjSQL & text1 & ")"<BR>End if<BR><BR><BR>That way it only enters in the values/fields of nonblank fields into the SQL statement. However, you will need to have some sort of SQL Column and Form that will not change that you can use the start the query (for grammer of commas, etc.)<BR><BR>If someone has a more efficient way, I&#039d be grateful to hear it as well!

  4. #4
    K. St-Louis Guest

    Default RE: Update problems

    Yes, this is more what I had in mind. I will try it!<BR><BR>Thanks so much for the suggestion.<BR><BR>kstlouis

Posting Permissions

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