Forums
This topic is locked
Add if Record not there update if it is?
Posted 09 Feb 2005 16:32:48
1
has voted
09 Feb 2005 16:32:48 Greg LeBreck posted:
In ASP with a SQL DBase....I have a page that updates a table. Is there a way to tell the update behavior that if the record does not exist then add it instead of update?
Replies
Replied 09 Feb 2005 17:13:39
09 Feb 2005 17:13:39 Vince Baker replied:
What you are trying to do is possible but as far as I am aware is not possible by using the Dreamweaver Update or Insert Server Behaviours....
You would need to have a recordset that checks if the value exisits, if not then run either an update command or insert command.
I can post you a couple of examples of the code used for this if that is what you decide to do.
Regards
Vince Baker
<strong>DMX Zone Manager</strong>
[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]
You would need to have a recordset that checks if the value exisits, if not then run either an update command or insert command.
I can post you a couple of examples of the code used for this if that is what you decide to do.
Regards
Vince Baker
<strong>DMX Zone Manager</strong>
[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]
Replied 10 Feb 2005 01:33:21
10 Feb 2005 01:33:21 Simon Martin replied:
You could also consider using a Stored Procedure with some conditional logic...
You'd still pass it the same values from the page - but let the database decide what to do with the data so just a single trip to the database.
Live the life you love
Love the life you live
~ ~ ~ ~ ~ ~ ~
<b>Simon Martin</b> - <i>DMXzone Manager</i>
<font size=1>[ Dreamweaver MX/MX2004 | ASP | SQL | XHTML/CSS | Web Accessibility ] </font id=size1>
You'd still pass it the same values from the page - but let the database decide what to do with the data so just a single trip to the database.
Live the life you love
Love the life you live
~ ~ ~ ~ ~ ~ ~
<b>Simon Martin</b> - <i>DMXzone Manager</i>
<font size=1>[ Dreamweaver MX/MX2004 | ASP | SQL | XHTML/CSS | Web Accessibility ] </font id=size1>