VB Devil

I have built my own Delete and Insert queries for a tableadapter (used the query builder for one and stored procedures for the other.) When I run my program (F5), I get no errors but the data does not delete or get inserted. I have checked the BIn\release database and I have also set the property in the Sloution Explorer window to "Copy if newer". Here is my code:

ServAwdEmpsTableAdapter.DeleteQuerybyAwardDtRange(FromDate, ToDate)

The DeleteQuerybyAwardDtRange looks like:

DELETE FROM [dbo].[ServAwdEmps] WHERE AwardDt between @FromDate and @ToDate

I have done something similar with the Insert Query. I have tested the queries and they are correct but neither changes my data.Is there something else I need to do to get it to actually delete or insert these records

Re: Visual Basic Express Edition TableAdapter custom Delete and Insert queries

Feng Chen - MSFT

Hi VB Devil,

It seems that you should send the updated data back to the database after the data in your dataset has been modified and validated.

To update a database with a dataset using a TableAdapter, you can write the code like below:

Code Snippet





MsgBox("Update successful")

Catch ex As Exception

MsgBox("Update failed")

End Try

And There is a reference on how to update data using a TableAdapter:


Hope it will help you!


Re: Visual Basic Express Edition TableAdapter custom Delete and Insert queries

VB Devil

No, it is still not working. Let me describe my program better. I am using a form to enter a month and a year. Using that data, I am deleting all records in a table with a date between the beginning and end of the month - that is my Delete query. Then I gather information from two other tables and I insert new records into the first table with an Insert query. So in fact, there really is no binding source. But I did add a binding source on one field and used the validate and endedit methods. I get the "successful" messages, but alas the data has not changed from either the Delete query or the Update query. There must be some way to update database tables which are not bound to a grid or input fields.