Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7436465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:14:38+00:00 2026-05-29T10:14:38+00:00

I wanted to delete a selected Item from a List control but can’t. What’s

  • 0

I wanted to delete a selected Item from a List control but can’t. What’s wrong with my code:

[Bindable]private var dp:ArrayCollection = new ArrayCollection();
private var conn:SQLConnection;

protected function Delete(event:MouseEvent):void    {
    Stmt = new SQLStatement();
    Stmt.sqlConnection = conn;
    Stmt.text = "DELETE FROM UserTable WHERE firstName="+listBox.selectedIndex;
    Stmt.execute();
}

<s:List id="listBox" itemRenderer="UserRenderer"></s:List>



In UserRenderer:

<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:s="library://ns.adobe.com/flex/spark">

    <s:Label text="{data.lastName}, {data.firstName}, {data.id}"/>

</s:ItemRenderer>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:14:39+00:00Added an answer on May 29, 2026 at 10:14 am

    List#selectedIndex refers to the position of the selected item in the dataprovider. The first element will have index 0, the second index 1 and so on. If no item is selected, selectedIndex will be -1.

    If you want to select or delete by firstName – as you do in your query – you will have to pass in a valid first name instead of an index position. You can do this with the List#selectedItem property. Also don’t forget the single quotes in your query if you’re not using query params.

    "DELETE FROM UserTable " +
    "WHERE firstName = '" + listBox.selectedItem.firstName + "'";
    

    You weren’t asking for this, but I’ll tell you anyway: for security reasons you should use query params when using variables in your queries. One way to achieve this in ActionScript is:

    stmt.parameters[0] = listBox.selectedItem.firstName;
    stmt.text = "DELETE FROM UserTable WHERE firstName = ?";
    

    (no single quotes required here)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to delete all the Items from SharePoint List using Lists webservice, i
I wanted to write a code that would delete a given character from a
I wanted to delete some records which i added recently, from this table mytemp,
From the My Sites view, one-by-one I selected several web sites I wanted to
I've created a custom ListView with checkboxes. I wanted to delete the selected items
How can I delete some lines(\r\n) from a binary data: for example if I
I want to delete the row from datatable. Here is the datatables code I
Problem description: I wanted a delete function which could perform delete/remove of the selected
I have a property object and I wanted to delete that from the latest
I'm using PUT and DELETE more and more w/ my ajax work and wanted

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.