Results 1 to 2 of 2

Thread: [RESOLVED] DataAdapter.Update not updating Access db

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2007
    Posts
    4

    Resolved [RESOLVED] DataAdapter.Update not updating Access db

    I'm sorry to start a thread on such a basic problem, but I cannot find what I'm doing wrong.

    VS 2005, Access 2003 database (created in Access 2007). (Note, I'm working largely from "Beginning Visual Basic 2005 Databases" by Thearon Willis as a reference).

    A quick intro before my code. This is a simple database application for the roster of my wrestling team. I have created a Jet database with multiple tables ("Wrestler", "Equipment", "Attendance", etc.). I am using an adapter to fill a dataset (from stored queries in the database file), then using a binding context to display the fields in textboxes on my form (along with navigation buttons). All of this seems to work fine and I can navigated through the records.

    However, my "save" button doesn't seem to update the database file. Here's the code:

    Code:
            dbCommand.Parameters.Add("@LastName", OleDbType.VarChar, 50, txtLastName.Text)
            dbCommand.Parameters.Add("@FirstName", OleDbType.VarChar, 30, txtFirstName.Text)
            dbCommand.Parameters.Add("@Status", OleDbType.VarChar, 20, cboStatus.Text)
            
            dbCommand.Parameters.Add("@CohortClass", OleDbType.Numeric, 0, nudCohort.Value)
            dbCommand.Parameters.Add("@Phone", OleDbType.VarChar, 20, txtTelephone.Text)
    
    [SNIP] (You get the idea)        
    
    
            dbCommand.CommandText = "usp_UpdateWrestler"
            dbCommand.CommandType = CommandType.StoredProcedure
            dbCommand.Connection = dbConnection
    
            dbAdapter.UpdateCommand = dbCommand
            dbAdapter.Update(dbDataset, "Wrestler")
    I suspect I'm missing something obvious. Any suggestions greatly appreciated!

    Thanks,
    Tim

  2. #2

    Thread Starter
    New Member
    Join Date
    Sep 2007
    Posts
    4

    Re: DataAdapter.Update not updating Access db

    Just a quick update:

    As I pore through MSDN, I'm tinkering with my .Add statements. It seems like maybe I need to set the .Value or .SourecColumn properties, but I'm not sure if I'm on the right track.

    Still no luck, so please let me know if you have any ideas.

    Thanks,
    Tim

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