1

Hey, I don't know how to remove a row in Access Database on C# I know how to add a row:

    Database3DataSet.ClientsDataTable Tclients = database3DataSet.Clients;
    Tclients.AddClientsRow(textBox1.Text, textBox2.Text);

But I don't know how to remove... Please help D:

Download link for the Application: http://uploading.com/files/11b69ce6/WindowsFormsApplication4.rar/ I Realy don't know why it's didn't work... Can you tell me what's the problem? Thanks. :)

4
  • Database3DataSet.ClientsDataTable doesn't appear to be a public library class. If that is not the case, can you post a link to it's documentation? Commented May 6, 2011 at 12:59
  • Download link for the Application: uploading.com/files/11b69ce6/WindowsFormsApplication4.rar I Realy don't know why it's didn't work... Can you tell me what's the problem? Thanks. :) Commented May 6, 2011 at 14:17
  • I still doמ't understand why the row isn't deleted from the database :( Commented May 6, 2011 at 16:31
  • Help? :( It's very important to me Commented May 6, 2011 at 19:51

1 Answer 1

1

There's a Delete() method on the DataRow object.

Tclients.Rows[0].Delete();
Tclients.AcceptChanges();  // commit the changes
Sign up to request clarification or add additional context in comments.

5 Comments

That is what I've done, And nothing happend: ` private void button3_Click(object sender, EventArgs e) { Database3DataSet.ClientsDataTable Tclients = database3DataSet.Clients; Tclients.Rows[listBox1.SelectedIndex].Delete(); } `
You'll need to also call the AcceptChanges() method. See here
Download link for the Application: uploading.com/files/11b69ce6/WindowsFormsApplication4.rar I Realy don't know why it's didn't work... Can you tell me what's the problem? Thanks. :)
@Jonas: Have you tried reloading your database after accepting the change? Your application typically does not know to reload on it's own.
Help? :( It's very important to me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.