p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 19th, 2009, 06:34 PM
Authorized User
Points: 187, Level: 3
Points: 187, Level: 3 Points: 187, Level: 3 Points: 187, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: St. Louis, Mo., USA.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default Update a disconnected dataset

I am having issues updating data from a disconnected dataset. here is the code I am using {based upon a C# snipet]


PrivateSub UpdateDataSet(ByVal dsSource As DataSet, ByVal tblName AsString, ByRef sMsg AsString)
Dim conn AsNew OleDbConnection()
Try
' Code to get updated values from DataGrid
' Fetch the cached DataSet from the Session object
' Code to update the appropriate DataRow
Dim dv As DataView = dsSource.Tables(tblName).DefaultView
' Reconnect to the database and Open
conn.ConnectionString = m_dbConn.ConnectionString
conn.Open()
' Make a new OleDbDataAdapter
Dim da AsNew OleDbDataAdapter("SELECT * FROM " & tblName, conn)
' Make a new OleDbCommandBuilder
Dim cb AsNew OleDbCommandBuilder(da)
' Do the update and rebind the DataSet to the DataGrid
da.Update(dsSource, tblName)
Catch ex As Exception
sMsg = sWhoamI & "doUpdate|" & ex.Message
Finally
If conn.State = ConnectionState.Open Then
conn.Close()
EndIf
EndTry
EndSub

Thanks in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Dataset Update Aaron Edwards ADO.NET 1 April 29th, 2005 05:26 AM
Problem with Dataset Update Aaron Edwards ASP.NET 1.1 1 April 27th, 2005 08:21 PM
dataset to databse update nashnash ASP.NET 1.0 and 1.1 Professional 1 December 10th, 2004 01:05 PM
How to update the datasource from using dataset syedjavid ADO.NET 3 August 1st, 2004 03:58 PM
Dataset Update with Null Value [V] reyboy ADO.NET 2 June 1st, 2004 01:18 PM



All times are GMT -4. The time now is 01:31 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc