Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 484
  • Last Modified:

How to add new records to a table

I have a form which has all its textboxes bound to a SQL dataset table "MstnatPersoon".  

Updates work fine.  To add new records is my roblem.
(In Microsoft Visual Basic 2005 and SQL server 2005 )

"Me.MstNatPersoonTableAdapter.Update(Me.HRDataSet.MstNatPersoon)"  and an FillBy,GetDataBy query are the ways by which I

update the rows.I thought this is also the same method to insert new records to the table,

but it doesn't work.
I also tried to make another query to insert the new values to the table fields.
For this I used :
Me.MstNatPersoonTableAdapter.InsertQuery(Me.HRDataSet.MstNatPersoon, ...."here I type in all

the parameters of the insertquery")
But this one also does not work.

Please reivew my code and let me know where I am going wrong or please do tell me about  
another method which I can use to insert new records to the table?
1 Solution
is there an "addNew" method or some such thing for the TableAdapter?

I'm not familiar with this, but in older technologies it would be
set values


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now