What if I don' t want a default value in the update statement? (Full Version)

All Forums >> [Web Development] >> ASP, PHP, and Database



Message


porsche944 -> What if I don' t want a default value in the update statement? (8/10/2002 17:57:12)

I made an update statment for 10 fields. But not all of them are filled in all of the time. When some fields are blank, I don' t want the default value tossed in there like ti is. i f I don' t have a default value, i get an error.

What do i do?




Spooky -> RE: What if I don' t want a default value in the update statement? (8/10/2002 18:01:48)

ASP or DRW?




KeithG -> RE: What if I don' t want a default value in the update statement? (8/10/2002 18:09:34)

Sometimes that can be eliminated (in access db) by changing the " allow zero length" field propery (in design view) to " yes" . That way you would not have to send the default value.....

Keith




porsche944 -> RE: What if I don' t want a default value in the update statement? (8/10/2002 18:57:45)

Spooky: i am using the DRW (on diet).

Keith: I have alreday have it det to allow zero legnth strings.
Anything else?




KeithG -> RE: What if I don' t want a default value in the update statement? (8/10/2002 19:09:52)

You should be able to use a custom query in the DRW (step 2), put your code in there like

UPDATE Customers SET ContactFirstName=' ::ContactFirstName::' ,ContactMiddleName=' ::ContactMiddleName::' ,ContactLastName=' ::ContactLastName::' WHERE CustomerID=::CustomerID::

and if someone leaves the middle name blank in the form it should update the record alright. Maybe the field names are mispelled or maybe without using " customer query" in the DRW it causes problems? Just a thought.

Keith




Spooky -> RE: What if I don' t want a default value in the update statement? (8/10/2002 19:15:19)

The reason I ask, is that it tends to be easier to conditionally construct a SQL string based on user input

eg

If trim(request.form(input)) <> " "  then
  sql = sql & " , ContactFirstName=' ::ContactFirstName::' , " 
End if


Are you concerned it will overwrite existing information?




porsche944 -> RE: What if I don' t want a default value in the update statement? (8/13/2002 1:29:15)

But i am being asked for default values for those fields. Using the drw at step 3 after the sql is in place. If i don' t set the default values i get an error when i try to update the record..saying one or more default values were empty.




Spooky -> RE: What if I don' t want a default value in the update statement? (8/13/2002 1:49:49)

You have to provide a value when using the DRW.
Parts of the SQL statement can be removed if using the diet.
Do you have an example SQL statement?




KeithG -> RE: What if I don' t want a default value in the update statement? (8/13/2002 9:53:58)

Porsche944,

I never put default values in that step but if you look at the underlying code produced FP automatically uses the field names used as the default. That said, I suspect that your problem may be in either a misspelled field name in the query, the default value if you are typeing them, or one of them does not match exactly the field name being sent from page 1. In my experience it is almost always a typo on my part. Just a thought.

Keith




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625