Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Deleting the contents of a database field


Message #1 by "Jon S. Jaques" <jjaques@g...> on Wed, 11 Oct 2000 16:19:05 -0400
Hello,



I wrote a script that allows a user to update their own records, but the

problem is that if the user *deletes* the info in one of the fields, ADO

throws an error.



I hacked my way around the problem by using this kludge that I want to get

rid of:



dim InsertVal

if Request.Form(FArray(F)) = "" then

	InsertVal = " "

else

	InsertVal = Request.Form(FArray(F))

end if



As you can see, I just set the value to a single space, which "works", but

it just doesn't seem right.



Thanks in advance!



--Jon



Message #2 by "peter" <ph@t...> on Thu, 12 Oct 2000 00:43:00 +0100
Have you tried 



dim InsertVal

if Request.Form(FArray(F)) = "" then

InsertVal = "" 

  'or InsertVal = "NULL" instead of writting a blank space

else

InsertVal = Request.Form(FArray(F))

end if



cheers



peter

Message #3 by "Ken Schaefer" <ken@a...> on Thu, 12 Oct 2000 11:43:40 +1000
How about checking the properties of the field in the database?

For example in Access, change the settings for the field to allow "zero

length strings" and make it "not required". This will allow zero-length

strings.



Cheers

Ken



----- Original Message -----

From: "Jon S. Jaques" <jjaques@g...>

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, October 12, 2000 6:19 AM

Subject: [asp_databases] Deleting the contents of a database field





> Hello,

>

> I wrote a script that allows a user to update their own records, but the

> problem is that if the user *deletes* the info in one of the fields, ADO

> throws an error.

>

> I hacked my way around the problem by using this kludge that I want to get

> rid of:

>

> dim InsertVal

> if Request.Form(FArray(F)) = "" then

> InsertVal = " "

> else

> InsertVal = Request.Form(FArray(F))

> end if

>

> As you can see, I just set the value to a single space, which "works", but

> it just doesn't seem right.

>

> Thanks in advance!

>

> --Jon





Message #4 by "Jon S. Jaques" <jjaques@g...> on Thu, 12 Oct 2000 14:35:58 -0400
Yes, it's a funny thing; I DID try both "" and Null, and when neither

worked, I went right to the database, in Access 2000 (not connected to sql),

and checked the field properties to make sure that it would allow a null

value.



I then tried manually adding a record without a value, and that worked, so I

tried deleting a value, and that worked, too!



The only thing I can think of is that I'm executing a SQL UPDATE statement;

Maybe I need to make one pass to update fields that have values, and another

pass to update (delete) fields that shouldn't have values?



--Jon



> -----Original Message-----

> From: peter [mailto:ph@t...]

> Sent: Wednesday, October 11, 2000 7:43 PM

> To: ASP Databases

> Subject: [asp_databases] Re: Deleting the contents of a database field

>

>

> Have you tried

>

> dim InsertVal

> if Request.Form(FArray(F)) = "" then

> InsertVal = ""

>   'or InsertVal = "NULL" instead of writting a blank space

> else

> InsertVal = Request.Form(FArray(F))

> end if

>

> cheers

>

> peter

>

> ---

> FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS

> IN YOUR INBOX!

> Get the latest and best HTML, XML, and JavaScript tips, tools, and

> developments from the experts.  Sign up for one or more of EarthWeb?s

> FREE IT newsletters at http://www.earthweb.com today!

> ---





Message #5 by "Jon S. Jaques" <jjaques@g...> on Tue, 17 Oct 2000 14:44:44 -0400
Still no more thoughts on this?



> -----Original Message-----

> From: Jon S. Jaques [mailto:jjaques@g...]

> Sent: Thursday, October 12, 2000 2:36 PM

> To: ASP Databases

> Subject: [asp_databases] Re: Deleting the contents of a database field

>

>

> Yes, it's a funny thing; I DID try both "" and Null, and when neither

> worked, I went right to the database, in Access 2000 (not

> connected to sql),

> and checked the field properties to make sure that it would allow a null

> value.

>

> I then tried manually adding a record without a value, and that

> worked, so I

> tried deleting a value, and that worked, too!

>

> The only thing I can think of is that I'm executing a SQL UPDATE

> statement;

> Maybe I need to make one pass to update fields that have values,

> and another

> pass to update (delete) fields that shouldn't have values?

>

> --Jon

>

> > -----Original Message-----

> > From: peter [mailto:ph@t...]

> > Sent: Wednesday, October 11, 2000 7:43 PM

> > To: ASP Databases

> > Subject: [asp_databases] Re: Deleting the contents of a database field

> >

> >

> > Have you tried

> >

> > dim InsertVal

> > if Request.Form(FArray(F)) = "" then

> > InsertVal = ""

> >   'or InsertVal = "NULL" instead of writting a blank space

> > else

> > InsertVal = Request.Form(FArray(F))

> > end if

> >

> > cheers

> >

> > peter

> >

> 

  Return to Index