473,486 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ado.net "add new"

Hi
I am just trying to get to grips with ado.net .

I simply wish to add data from some text boxes back to a new row in the
dataset on clicking a save button.

How do you create the new row in the dataset make sure this row is selected
and read the data from the text boxes to the various columns in the data
set?

Many thanks

Julian
Jul 19 '05 #1
3 8263
It's pretty straightforward and I thought it was in the
MSDN somewhere, but here's what you do:

Dim dRow as DataRow (or DataRow dRow in C#)

dRow = [DataTable].NewRow
(the name of the datatable variable goes in place of
[DataTable])

[DataTable].Rows.Add(dRow)
(This step can come before or after you set the values of
the columns)

dRow.item(i) = xxx 'Set the value of a column
(dRow[i] = xxx in C#)

That's it.

Jeff Levinson

Author of "Building Client/Server Applications with
VB.NET: An Example Driven Approach"

-----Original Message-----
Hi
I am just trying to get to grips with ado.net .

I simply wish to add data from some text boxes back to a new row in thedataset on clicking a save button.

How do you create the new row in the dataset make sure this row is selectedand read the data from the text boxes to the various columns in the dataset?

Many thanks

Julian
.

Jul 19 '05 #2
That's pretty much it except for the order of adding the row to the table vs
settting the data. If the table has a primary key, which all good tables
should, you will need to at least set the value for this field before adding
the row to the table. I personally find it better practice to set any
fields you know in advance before adding the row to the table.

Rick

"Jeff Levinson [mcsd]" <je***********@comcast.net> wrote in message
news:0c****************************@phx.gbl...
It's pretty straightforward and I thought it was in the
MSDN somewhere, but here's what you do:

Dim dRow as DataRow (or DataRow dRow in C#)

dRow = [DataTable].NewRow
(the name of the datatable variable goes in place of
[DataTable])

[DataTable].Rows.Add(dRow)
(This step can come before or after you set the values of
the columns)

dRow.item(i) = xxx 'Set the value of a column
(dRow[i] = xxx in C#)

That's it.

Jeff Levinson

Author of "Building Client/Server Applications with
VB.NET: An Example Driven Approach"

-----Original Message-----
Hi
I am just trying to get to grips with ado.net .

I simply wish to add data from some text boxes back to a

new row in the
dataset on clicking a save button.

How do you create the new row in the dataset make sure

this row is selected
and read the data from the text boxes to the various

columns in the data
set?

Many thanks

Julian
.

Jul 19 '05 #3
Looks too easy!

Many thanks

Julian

"Rick Ferguson" <ri***@ftech.on.ca> wrote in message
news:53****************@news20.bellglobal.com...
That's pretty much it except for the order of adding the row to the table vs settting the data. If the table has a primary key, which all good tables
should, you will need to at least set the value for this field before adding the row to the table. I personally find it better practice to set any
fields you know in advance before adding the row to the table.

Rick

"Jeff Levinson [mcsd]" <je***********@comcast.net> wrote in message
news:0c****************************@phx.gbl...
It's pretty straightforward and I thought it was in the
MSDN somewhere, but here's what you do:

Dim dRow as DataRow (or DataRow dRow in C#)

dRow = [DataTable].NewRow
(the name of the datatable variable goes in place of
[DataTable])

[DataTable].Rows.Add(dRow)
(This step can come before or after you set the values of
the columns)

dRow.item(i) = xxx 'Set the value of a column
(dRow[i] = xxx in C#)

That's it.

Jeff Levinson

Author of "Building Client/Server Applications with
VB.NET: An Example Driven Approach"

-----Original Message-----
Hi
I am just trying to get to grips with ado.net .

I simply wish to add data from some text boxes back to a

new row in the
dataset on clicking a save button.

How do you create the new row in the dataset make sure

this row is selected
and read the data from the text boxes to the various

columns in the data
set?

Many thanks

Julian
.


Jul 19 '05 #4

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

Similar topics

0
1627
by: Yi | last post by:
Hi, I am a scientist and new to .NET programming. On my PC, I am using Windows 2000 professional with IIS, SQL Server 2000 (standard, personal), Visual Basic .net (2003, standard). By following...
4
7133
by: meganrobertson22 | last post by:
Hi Everyone- I have a question about how to add and then use the "All" selection in a combo box. I am trying to figure out how to: (1) add "All" as a selection to a combo box and then (2)...
10
5052
by: msnews.microsoft.com | last post by:
Hi, How do I add a reference in VC++.NET? In VB.NET and VC#.NET, there's an option in "Project" menu called "Add Reference". This will add a .NET DLL reference to the current project. After I...
5
10303
by: Mike Logan | last post by:
I used WSDL.exe to generate a client side web proxy for a web service, called the web service, got the results but an array returned by the web service is not in the results. However if I use...
0
1672
by: . | last post by:
http://daviderognoni.blogspot.com?locawapp - MAIN NEWS =========== * add thread * add "Request" object * new "locawapp_main" function * fixed files.py
2
5139
by: SAL | last post by:
I have the following line of code in my Page_Load Event of my ASP.net page: txtExplanationofChange.Attributes.Add ("style","overflow :hidden"); which allows me to can turn off the Scrollbar of my...
2
7540
by: Ottavio | last post by:
Hello, I'm having some problems with the authentication during a web service call I know I have to add the "Authorization: Basic xxxxxxxx" in the http header (not soap header) but I can't find a...
3
3612
rsmccli
by: rsmccli | last post by:
Using AC2002 Hello. I am working with an existing DB that has "Add New" command buttons on two forms. When I, an Admin, click the buttons, they work properly, and a new, blank form is created,...
4
9824
by: FullBandwidth | last post by:
I have been perusing various blogs and MSDN pages discussing the use of event properties and the EventHandlerList class. I don't believe there's anything special about the EventHandlerList class in...
0
1884
by: Afshar | last post by:
Whenever I add a key to Headers it turns to a lower cased one while Headers is of type NameValueCollection and NameValueCollection itslef does not apply any lower or upper case change. Please...
0
7094
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
7123
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
7173
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
7305
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...
0
5427
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,...
1
4863
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4559
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...
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.