locked
deleting rows from database using datagridview RRS feed

  • Question

  • Hi,
        I am doing a project in c#, and i  want to delete Rows from database using datagridview, i mean when user try to Remove one or more rows by pressing delete key corresponding rows should be deleted from the database too for permanently. Please Help me,  



    private void Form4_Load(object sender, EventArgs e)
            {
                DataSet ds = new DataSet();
                Database db = new Database();
                db.open();
                SqlDataAdapter d1 = new SqlDataAdapter("select * from DETAILS1", db.con);

                d1.Fill(ds);
                dataGridView1.DataSource = ds.Tables[0];
                db.close();    
            }

    DETAILS2 table definition 


    ID_A numeric(20, 0)
    PURCHASE_DATE datetime
    BILL_NO numeric(20, 0) PRIMARY KEY
    PARTY_NAME varchar(50)
    AMOUNT_PURCHASED numeric(20, 2)

    Please help me,...

    Thanks and Regards
    JALAL.TK

    • Moved by Victor_Chen Friday, January 21, 2011 7:53 AM dataset (From:Visual Studio Extensibility)
    Wednesday, January 19, 2011 5:17 PM

Answers

All replies