Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 30th, 2006, 12:40 PM
Authorized User
Join Date: Mar 2006
Location: , , .
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?

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 05:53 AM.

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