![]() | ![]() |
|
06-03-2011 03:34 PM
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
Solved! Go to Solution.
06-03-2011 03:46 PM
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
06-03-2011 03:47 PM
06-03-2011 03:51 PM
This is correct except for you have to use EXECSQL,for update, delete and insert statements
and DSN has to be in quotes " "
, but if your deleting tables in the metastorm database, not DSN is needed.
06-03-2011 03:52 PM
06-03-2011 03:52 PM
09-08-2011 02:35 PM
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.
09-09-2011 09:17 AM
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 <stuff> 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.
![]() |
![]() |
![]() |
|
|
![]() |
![]() |
![]() |
















