×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Problem with deleting a datarow in an SQL database using VB.NET.

Problem with deleting a datarow in an SQL database using VB.NET.

Problem with deleting a datarow in an SQL database using VB.NET.

(OP)
I am a newbie with vb.net and SQL and I have run into a bit of a snag.  

I have written code to manipulate an SQL database.  I have routines to connect, read, query, edit, add, delete and update data to the database.  

Everything seems to be working just fine, except the delete function.  I am not getting any errors - the data just does not get deleted from the database.  

The method I'm employing is declaring a dataset and a data adapter.  I am filling the dataset, (mydataadapter.fill(mydataset,tbl)), then updating the database thru the data adapter.  When I do the delete function (rows.remove), it removes the line from the dataset, but the database does not get updated.  The update function works when I add or edit data, just not when I delete data.  

I have a sqldataadapter control on the form.  The properties page for this control has a the following delete command:

DELETE FROM Emp01
WHERE     (EmpID = @Original_EmpID) AND (FName = @Original_FName OR
                      @Original_FName IS NULL AND FName IS NULL) AND (LName = @Original_LName OR
                      @Original_LName IS NULL AND LName IS NULL)


Any help would definitely be appreciated - I am really struggling with this.

Thanks in advance.

Replies continue below

Recommended for you

RE: Problem with deleting a datarow in an SQL database using VB.NET.

(OP)
To anyone interested.  

I did find the solution to my problem - I was using the wrong delete command.  I used the:
mydataset.tables(tablename).rows.remove command and needed the
mydataset.tables(tablename).rows.delete command.

-mjs84

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close