Wrox Programmer Forums
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 30th, 2006, 12:40 PM
Authorized User
Join Date: Mar 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default Updating Database from Dataset

I have a class that creates a dataset and dataadapter.
When the user updates a Windows form, I want the dataadapter to update the DB of course. The code runs without an error , but the database does not get updated.
here is where the Dataadapter is created:
        Me.EmployeeDA = New SqlDataAdapter("SelectedEmployee",
        'Dim SELECTED As New DataSet
        With EmployeeDA
            .TableMappings.Add("Employees", "SelectedEmployee")
            .MissingSchemaAction = MissingSchemaAction.AddWithKey
            .SelectCommand.CommandType = CommandType.StoredProcedure
            .SelectCommand.Parameters.Add("@LastName", empLname)
            .SelectCommand.Parameters.Add("@FirstName", empFname)
            .FillSchema(SELECTED, SchemaType.Source)
        End With
no errors there and the dataset gets filled with exactly one row as it should.

Ok, edit the current data in the dataset

        Dim drCurrent As DataRow
        drCurrent = oEmployee.SELECTED.Tables(0).Rows.Find(empID)
        drCurrent("Title") = oEmployee.Title
OK , send the changes back to the Database


this all runs without error, but the database does not update.
is this code correct, or am i missing something?

Similar Threads
Thread Thread Starter Forum Replies Last Post
updating a dataset hexOffender VB.NET 2002/2003 Basics 1 September 28th, 2006 05:13 PM
Updating Datagrid From Dataset Issue hannahforinton C# 2 May 30th, 2006 12:19 PM
Updating Database w/Dataset -Failure KennethMungwira ADO.NET 5 April 24th, 2006 04:54 AM
problem in updating in dataset vohra_vikas2004 ADO.NET 1 June 28th, 2005 05:26 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.