473,387 Members | 1,486 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,387 software developers and data experts.

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 2840
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 OleDbDataAdapter(strSQL,conn)
Dim ds As New DataSet()
da.Fill(ds)

' do your stuff with the DataSet here

Dim cb As New OleDbCommandBuilder(da)
' update the database with the dataset
da.Update(ds)
Catch ex As Exception
lblError.Text=ex.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
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...
4
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
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...
4
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...
10
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...
2
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...
2
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...
1
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...
5
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
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...

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.