473,796 Members | 2,875 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to save a dataset back to the database

greetings,

i've manually created a dataset which contains data input from users. i
validate the dataset against the business logic and once everything is done,
i would like to save the values in the dataset into the database. the
database has 5 columns and so does my dataset. my dataset has all the same
name field name and datatype as the database. is there a possibility to merge
the dataset in to the database?

i was hoping there would be a way so that i can avoid loop insert. insert
row by row into the database. thanks for help me out..

Nov 18 '05 #1
1 2876
Jos
Asha wrote:
greetings,

i've manually created a dataset which contains data input from users.
i validate the dataset against the business logic and once everything
is done, i would like to save the values in the dataset into the
database. the database has 5 columns and so does my dataset. my
dataset has all the same name field name and datatype as the
database. is there a possibility to merge the dataset in to the
database?

i was hoping there would be a way so that i can avoid loop insert.
insert row by row into the database. thanks for help me out..


Use the Update method on the DataAdapter:

Dim conn As New OleDbConnection (strConn)
Try
conn.Open()
' fill dataset from the database
Dim da As New OleDbDataAdapte r(strSQL,conn)
Dim ds As New DataSet()
da.Fill(ds)

' do your stuff with the DataSet here

Dim cb As New OleDbCommandBui lder(da)
' update the database with the dataset
da.Update(ds)
Catch ex As Exception
lblError.Text=e x.Message
Finally
conn.Close()
End Try

--

Jos
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1639
by: Torben Madsen | last post by:
Hello, I'm trying to save the changes back to the database, but it doesn't work -could anybody help me? I'm using a DataSet and the wierd thing is that I can save the changes in the memory but not in the database :-/ I have tried to duplicate an example I found on msdn -but with no luck. The sourcecode is in C#: --------------------------------------------------------------------- Sourcecode
4
6234
by: Jaime | last post by:
I have to save a dataset to xml and for efficiency I like to get rid of the namespace prefix d2p1: can any one help thanks jaime
2
4828
by: Alpha | last post by:
Hi, I have a window based program. One of the form has several textboxes and a datagrid. The textboxes are bind to the same dataset table as the datagrid and the text changes to reflect different row selected in the datagrid. I want to save the changes that user make in the textboxes when they select a different row in the datagrid. I tried capturing the textbox.text at datagrid's CurrentCellChanged event but by then the textbox.text...
4
4535
by: Jae | last post by:
I'm writing a web application that exports and imports excel files. The application gets a list of users and their info and displays it in a datagrid .The user then selects to save the file as a tab delimited file or an excel file. The application then saves the file in the correct format. The flip side is for the user to import/upload the file to the server The application must be able to import the excel file and read the contents. I...
10
39517
by: Henok Girma | last post by:
Hello Gurus, I want to save the state of an unbound DataGridView on my Windows Form application to an XML file so i can later load it back.. Basically, on my form I have a DataGridView, it's got some DataGridViewTextBoxCell, DataGridViewComboBoxCell etc, i want to export all that to XML.. Any help is greatly appreciated.
2
3888
by: toddw607 | last post by:
Hi all! I am attempting to bring an SQL Server table into ASP.NET using the datagrid . I have set all cells to be a text box by which the user can just click on and edit the cell. I have a save button and when I click the save button the page reloads and the new data is in the cell, however when I close out and come back in the data is no longer there. I have a databind() subroutine which includes a postback included within my code for...
2
9621
by: Ronald S. Cook | last post by:
In my client Windows application, I am receiving a DataSet containing one DataTable. This comes to my client via the business tier on a different physical machine (we're using WCF if that matters). After I make changes to the data in the underlying DataTable, I send the DataSet back to the business tier. In the business tier, what should my code look like to persist the data up to the database? I'm assuming I need to do something...
1
2620
by: TonyJ | last post by:
Hello! I'm using VS2005. I'm looking at ADO.NET and have found some test tutorial solution on microsoft MSDN. The one that I'm looking at now is called Walkthrough: Saving Data to a Database (Single Table) I have followed the walkthrought exectly but it doesn't work as expected.
5
7620
by: countnazgul | last post by:
Hello, I've got very odd problem. I use windows application to store files in data base (MySql) and then to extract this files from data base and save it on hdd. But when i save them back to hdd tihs files are 1Kb less from original file. When i insert pictures this 1kb obviously is not imported and the pictures is shown. But other files when try to be opened is corrupted or if they open some error message is shown. So the code that i use to...
0
9679
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9527
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10453
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10172
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.