473,396 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Saving updates to a datatable to database

347 100+
I have a form in my application that presents users with a datagridview which pulls data from database-a. I then offer the users the ability to edit that data but what I'd like to do is when they click the save event, that it saves their changes to database-b. Can this be done?

Thank you

Doug
Apr 12 '11 #1
2 2970
Create a connection to the second database, and then have the tablemanager update the table for the second database instead of the first:

instead of:
Expand|Select|Wrap|Line Numbers
  1. Me.TableAdapterManager.UpdateAll(Me.Database1DataSet)
Use:

Expand|Select|Wrap|Line Numbers
  1. Me.TableAdapterManager.UpdateAll(me.Databse2Dataset)
May 25 '11 #2
dougancil
347 100+
Mreed,

here's the code I have thus far:
Expand|Select|Wrap|Line Numbers
  1.     Private Sub ExceptionEdit_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.         'TODO: This line of code loads data into the 'MDRDataSet.scratchpad3' table. You can move, or remove it, as needed.
  3.         Me.Scratchpad3TableAdapter.Fill(Me.MDRDataSet.scratchpad3)
  4.         Exceptioncopy()
  5.     End Sub
  6.     Private Sub SaveExceptionButton(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles saveexceptionsButton.Click
  7.         Dim oCmd2 As System.Data.SqlClient.SqlCommand
  8.         oCmd2 = New System.Data.SqlClient.SqlCommand
  9.         Try
  10.             With oCmd2
  11.                 .Connection = New System.Data.SqlClient.SqlConnection("Initial Catalog=mdr;Data Source=xxxxx;uid=xxxxx;password=xxxxx")
  12.                 .Connection.Open()
  13.                 Me.TableAdapterManager.UpdateAll()
  14.                 MsgBox("Update successful")
  15.             End With
  16.         Catch ex As Exception
  17.             MsgBox("Update failed")
  18.         End Try
  19.     End Sub
  20.  
and I tried to add the me.tableadaptermanager code to this form and intellisense is telling me that tableadaptermanager is not part of my form.
May 25 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Roy Gourgi | last post by:
Hi, Is it possible to save to a database as opposed to saving to a flat .txt file? It could be any database program, such as FoxPro (preferably), SQL Server, MySQL. Furthermore, I would also...
1
by: rohith | last post by:
Hope someone can help with this question. I have a digital camera that will be used to capture photographs for picture ids. My question is whether I can capture the image from a web page...
2
by: enforcer6767 | last post by:
Hi all, I am able to save, update, delete etc to data in already existing tables, but i can't seem to work out how to create and save a new table to a database. Using Visual Studio 2005, VB. I've...
0
by: surana | last post by:
Find the latest updates on IBM database mangement and other topics related to IT such as software testing, Decoding, Flowchart prepartaion and many more... ...
0
by: surana | last post by:
Find the latest updates in database management and SQL server tools and techniques. More details about software testing, flowchart preparation and many more ...
0
by: surana | last post by:
Find the latest updates in SQL server tools and techniques. More details on database management, software testing, flow chart prepartation and many more http://www.sqlserversoftware.blogspot.com...
0
by: surana | last post by:
Find the latest updates in SQL server tools and techniques. More details on database management, software testing, flow chart prepartation and many more http://www.sqlserversoftware.blogspot.com...
9
by: tezu | last post by:
hi all, I have developed a code which writes into an xml ,after writing im saving them as XML file only. i want to know how can i save it into a database. Is there any function available for doing...
5
by: Axirius | last post by:
Hi everybody, Asking for some help over here. My issue is that I´m looking how to copy or extract a particular table content of a website. I get the content from a external feed provider...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.