Please help writing SQL in JScript.
I need to delete rows from the database when the user cancels out of a form. While in the form, the user may insert rows into a grid, and this is done by a database row insert which doesn't automatically roll back when the user cancels the form.
Can someone please tell me how to put simple sql into JScript and/or just share an example?
Many thanks!!!!
Rick
Comments
-
Try this:
function deleteRows()
{
ework.SelectSQL("DELETE FROM [tablename] WHERE [columnname] = '" + ework.[variablename] + "')",[DSN]);
}
Just replace everything inside the [ ] with your custom info.
Regards,
Karen Frazier
0 -
Great, thanks!!!
0 -
I was not aware that a DSN wasn't required for a DELETE statement. Thanks!
0 -
Yes, thanks. I am using the default metastorm database.
0 -
kanangela77 wrote:
Try this:
function deleteRows()
{
ework.SelectSQL("DELETE FROM [tablename] WHERE [columnname] = '" + ework.[variablename] + "')",[DSN]);
}
Just replace everything inside the [ ] with your custom info.
Regards,
Karen Frazier
I am trying to do something similar but this isn't working for me, I get "ework is undefined".
Here is the code I am using:
var countDependents = ework.SelectSQL("select count(distinct(depid)) from ew_mrpbs.isdependentprofile where pin = '"+pin+"' and ACTIVE_FLAG = '"+activeFlag+"'");
I am using a client side validation script that runs on submit on a form.
0 -
The ework.SelectSQL approach only works in server side scripts.
I am unsure how to do that client side directly. When we have similar needs as I think you're trying to accomplish, we have a client script do client side stuff (are you sure? kind of thing). Then we do buttonClick(serverbutton) which is a hidden server side containing the other code (delete in your case).
Another possibility, again depending on exactly what you're trying to accomplish, may be to have your client validation do and then on the when user saves form handle the delete. If the client stuff fails (e.g. they click cancel on a validation or something) then the server side shouldn't fire off.
0
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 155 General Questions
- 149 Thrust Services
- 57 Developer Hackathon
- 37 Thrust Studio
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 33 eDOCS
- 190 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 10 XM Fax
- Follow Categories