Deleting Record from SQL Database

C

Colin

Hello,

I have a form that queries an SQL database. What I am looking for is
JScript code that would allow me delete the current record from the database
at the click of a button. I would really appreciate any assistance anyone
could provide.

Thank you,

Colin
 
K

Kalyan Reddy

S

S.Y.M. Wong-A-Ton

How do you have your form set up? Is it bound to 1 database table? And how do
you select a record? Are you using a repeating table to show records?

Deletion of records at the click of a button is possible through JScript
code; it just depends on the setup of your form.
 
C

Colin

Yes it is bound to 1 database table, and yes I am using a repeating table to
show the records.

At this point I am using the record ID to query the database and populate
the information into the form.
 
S

S.Y.M. Wong-A-Ton

You can add a button to the repeating table. This button will appear for each
record. Add a field to the Main data source to save the ID of the record to
delete. The value of the field must be set through a rule on the button in
the repeating table (don't forget to use current() when doing this). Once you
have the ID of the selected record, you can use code behind the button in the
repeating table to retrieve this ID, use it in an XPath filter on the XML of
the Main DOM to retrieve the node to delete, use the removeChild() function
to delete the selected node, and then submit the form back to the database
using the Submit() function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top