|
| |
|
|
kmc
Posts: 108 Joined: 3/8/2002 From: Status: offline
|
update DB - 3/30/2002 23:16:29
I have a form to update my DB records and it works to change any field in my DB. The only problem I have is that I have all my DB fields on my update form. Sometimes I don't want to update lets say the name field, so I leave it blank. When I leave it blank and submit my update it will delete the name in the DB record instead of leaving it alone. How can I change only the DB fields in a record that I want to change without having to fill out all of the fields again?
|
|
|
|
TimC
Posts: 199 From: Greenville SC (& or) Monterrey Mexico Status: offline
|
RE: update DB - 3/31/2002 7:20:22
prefill the form fields with the existing record, so that all the fields will resubmit with existing data except the fields you change. great example on http://www.asp101.com/samples/db_edit.asp that I use all the time If at first you DO succeed, try not to look astonished!
|
|
|
|
kmc
Posts: 108 Joined: 3/8/2002 From: Status: offline
|
RE: update DB - 3/31/2002 22:44:44
Does anybody have an easier way?
|
|
|
|
Light
Posts: 200 Joined: 3/28/2002 From: Earth Status: offline
|
RE: update DB - 3/31/2002 23:29:09
You should use <%=FP_FieldHTML(fp_rs,"your_field_name")%> as an initial value for all the fileds that you want or not to update! I tried this before and it works!
|
|
|
|
davebukouricz
Posts: 300 From: Ma None Status: offline
|
RE: update DB - 4/2/2002 19:58:43
I have an easier way. on your update page, create a query, and build a recordset based on that query, the same record you're updating. Example. if I were updating a record in usertable, field name is "name" slq="select name from usertable where (id="&id&")" rs1=Conn.execute(sql) Name=rs1("Name") Now that I have defined the current contents of name it is a matter of testing the form filed for empty, and filling in the update like so.. strnewName=request("newname") If strnewName<>"" Then updatename=strnewName Else updatename=Name End If In this way if the form field is empty it will reinsertt the current contents. By the way this is also a good tool to remember if you are creating a message board, where you want to append the new text to the current contents of a database text/memo field. Dave <%Do While still looking down at the grass instead of up at the roots%> Dave
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|