How to add new records to a table

Posted on 2006-06-01
Last Modified: 2006-11-18
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?
Question by:bdsnv
    1 Comment
    LVL 4

    Accepted 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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now