Results 1 to 3 of 3

Thread: Inserting to database

  1. #1

    Thread Starter
    Fanatic Member davebat's Avatar
    Join Date
    Dec 2002
    Posts
    727

    Inserting to database

    I have created a windows application in visual studio 2005, I need to insert a record into a local access database.

    I have set up a .xsd, but the problem is im not sure what I'm doing. I have created the insert query, called it from a button click using

    Code:
     Dim PatientUpdate As New AnteNatalBookerDataSetTableAdapters.tblPatientDetailTableAdapter
            PatientUpdate.NewPatient(nhsNumber, DOB, RBHNumber, surname, forename, prevSurname, title, addStreet, addCity, AddCounty, AddPost, AddAppStreet, AddAppCity, AddAppCounty, AddAppPost, homePhone, workPhone, language, Interpreter, Resident, Visitor, RegGp)
    and although the page doesn't error a record isn'y inserted, I suspect it has inserted a record into a local recordset, if this is the case how do i update my actual database?

  2. #2
    Frenzied Member circuits2's Avatar
    Join Date
    Sep 2006
    Location
    Kansas City, MO
    Posts
    1,027

    Re: Inserting to database

    Did you add the DataBase as a DataSource in your project? If so, you can click on it in the DataSource Viewer and change it's CopyToOutputFolder property to never.
    Show the love! Click (rate this post) under my name if I was helpful.

    My CodeBank Submissions: How to create a User Control | Move a form between Multiple Monitors (Screens) | Remove the MDI Client Border | Using Report Viewer with Visual Studio 2012 Express

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Inserting to database

    I think circuits meant to select your database file in the Solution Explorer, then open the Properties window and set Copy To Output Folder property. Also, I'd recommend setting it to Copy If Newer. That way if you make any changes to your original database then a new copy will be created in your output folder and you'll start using the new schema immediately.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width