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

updating database using datatable

hi guys...

i am a student, i am studying and i am a newbie in VB.net and i am
using SQL Server 2000.

I have this datatable which i insert rows (may take up to 2 or more
rows because i would like to perform batch updating). upon clicking of
update button, i would like to insert them all in a table in my
database.

I know this question has been posted before but could you show me guys
a sample code or a link to a code where i can study how to update a
database by a datatable.

help in anyway is very much appreciated.

Thanks

Joel - newbie

Sep 19 '07 #1
1 8191
Hi Joel,

A DataTable is a disconnected set of data. It may or may not be data from a
database, or have anything to do with a database. When a DataTable is
populated from a database, it must be populated by a DataReader, either as a
member of a DataAdapter, or independently. The DataReader or DataAdapter has
the Connection to the database. So, to insert data into a database, either a
Connection and Command must be used, or a DataAdapter, which contains a
Connection and a set of Commands must be used. In any case, the data is not
literally updated as a batch, but in a looping construct that inserts the
records one at a time. How you wish to do the insertion work is up to you.
For more information, see the following:

http://msdn2.microsoft.com/en-us/lib...x7(VS.71).aspx
http://msdn2.microsoft.com/en-us/lib...wf(VS.71).aspx
http://msdn2.microsoft.com/en-us/lib...8z(VS.71).aspx

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"joel" <co*********@hotmail.comwrote in message
news:11**********************@n39g2000hsh.googlegr oups.com...
hi guys...

i am a student, i am studying and i am a newbie in VB.net and i am
using SQL Server 2000.

I have this datatable which i insert rows (may take up to 2 or more
rows because i would like to perform batch updating). upon clicking of
update button, i would like to insert them all in a table in my
database.

I know this question has been posted before but could you show me guys
a sample code or a link to a code where i can study how to update a
database by a datatable.

help in anyway is very much appreciated.

Thanks

Joel - newbie

Sep 19 '07 #2

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

Similar topics

1
by: sandman | last post by:
I've got a simple windows form with some bound textboxes and Save button. Each texbox is bound to column in a table in an Access database. The form fills fine - all the fields show the correct...
3
by: Jon Agiato | last post by:
Hi, I am trying to use a data grid in a web application in which I have three tiers. The DataGrid is not set up to a data source, or a data adapter, so everytime I make a change I send the cell...
1
by: Luis Esteban Valencia | last post by:
Hello Everyone, Iam an intermediate ASP.Net programmer and iam facing a challenging task. I have a table in MS-SQL server database called 'Members'. The table has following fields... ...
13
by: Doug Bell | last post by:
Hi, I thought I had this sorted this morning but it is still a problem. My application has a DataAccess Class. When it starts, it: Connects to a DB (OLE DB) If it connects it uses an...
3
by: RSH | last post by:
Hi, I have a situation in where i have two instances of SQL server, the first is our Production Environment, the second is our Development environment. Both servers contain the same databases...
6
by: Rich | last post by:
Dim da As New SqlDataAdapter("Select * from tbl1", conn) dim tblx As New DataTable da.Fill(tblx) '--works OK up to this point da.UpdateCommand = New SqlCommand da.UpdateCommand.Connection =...
0
LoanB
by: LoanB | last post by:
Hey guys need some info here. I am adding, updating and deleting data on a datagrid. I pass the datagrid's datasource (datatable dt) to my data layer. Assuming I have already created and...
1
by: jonbartlam | last post by:
Hi There I'm not sure what exactly is going wrong here. I'm writing an application that retreives a table from a database (tbl_internalfaults) and updates it. (Actually, just the status column will...
1
by: Wavey | last post by:
Hi All, I have a problem with updating an Access database from a datatable. I have two rows of data in my database at the moment for testing, the first row is an ID number (primary key), the...
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:
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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
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...

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.