Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 02:07

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[C#] Delete listbox item that using DataSource from mdb(MS ACCESS)

Discussion on [C#] Delete listbox item that using DataSource from mdb(MS ACCESS) within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
PraDevil[ELITE]'s Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 1,486
Received Thanks: 919
Question [C#] Delete listbox item that using DataSource from mdb(MS ACCESS)

i create a winform program and have a listbox and delete button in my form. my listbox is using a datasource/databinding that come from .mdb(Microsoft Access) file. here are the delete button code i use now
Code:
private void deletepcsetting_Click(object sender, EventArgs e)
{
    DialogResult dialogResult = MessageBox.Show("Are you sure want to delete PC No " + listBox1.SelectedItem + "?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
    if (dialogResult == DialogResult.Yes)
    {
        PCNo selectedPCNo = (PCNo)listBox1.SelectedItem;
        if (selectedPCNo != null)
        {
            OleDbCommand cmd = new OleDbCommand("DELETE FROM ClientListing WHERE PCNO = " + listBox1.SelectedItem + "", GetConnection());
            _pcno.Remove(selectedPCNo);
        }
        GetConnection().Close();
    }
}
ignore about the message box, the code above successful delete the item from my listbox but not from the database(mdb), so this thing give me a problem because after reopen the form i notice the item that has been deleted before is still there(its just delete from listbox but not mdb)

i also has tried to change delete command from " + listBox1.SelectedItem + " to "selectedPCNo" but i don't get luck..does anyone know how to achieve this? sorry for my bad english anyway..
PraDevil[ELITE] is offline  
Old 02/20/2013, 13:35   #2
 
elite*gold: 5
Join Date: Mar 2008
Posts: 460
Received Thanks: 436
where do you open the database connection?

Give more informations about your code, or people can't help you.
SwarN is offline  
Reply


Similar Threads Similar Threads
[HELP] Delete item
09/04/2020 - SRO Private Server - 4 Replies
hello my GM char item bug. ITEM_MALL_M_SANTA item write and item wear.now char bug have :( ID - PW enter 1-2 sec. later game error
Delete item by Serial
02/13/2013 - SRO Private Server - 5 Replies
Hey guys i need a bit help, how i can find items where created by a GM and how i can delete it ? Maybe someone can help me ty. Sincerely anikan1985
[HOW] How to Delete NPC and Item
11/06/2011 - EO PServer Hosting - 3 Replies
How to delete them? i cant find in cq_NPC and cq_itemtype all i need just query to remove them someone help me :)
[Request] Selected Item in listbox
11/22/2008 - CO2 Private Server - 6 Replies
Ok so i've been working on my own Admin panel for a LOTF source and been working on the disconnect from a listbox option. foreach (DictionaryEntry DE in World.AllChars) { Character Charr = (Character)DE.Value; if (Charr.MyClient.Online) { listBox1.SelectedItem = listBox1.SelectedItem; Charr.MyClient.Drop(); return;
Delete an Item in Mail
02/14/2005 - WoW Exploits, Hacks, Tools & Macros - 0 Replies
1. Find someone annoying ie a person who constantly is spamming an item they own. 2. Tell them you are interested in it and have it sent to you COD 3. Open the mail but dont buy, delete, or return it. Let it stay there for 3 days in limbo. 4. In 3 days the email will be deleted like junk mail. 5. It will not be returned to the sender. ------ gut um paar lamer auf die eier zu gehn :>



All times are GMT +1. The time now is 02:08.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.