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

Ado.Recordset.AddNew, .Update, .MoveFirst, .Delete, etc...


I just spent 4 months taking a dotnet class where i learned very
little. One of the things I did not learn is this: What are the
dotnet equivilents of commands such as:

Adodc1.Recordset.AddNew
Adodc1.Recordset.Update
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.MoveNext
Adodc1.Recordset.Delete

I understand how to connect to the database, set up the data adapter,
create a dataset, but USING any of this data in a practical way seemed
way beyond the knowledge of the instructor.

Thanks

Nov 20 '05 #1
5 25429
<to**************@hotmail.com> schrieb

I just spent 4 months taking a dotnet class where i learned very
little. One of the things I did not learn is this: What are the
dotnet equivilents of commands such as:

Adodc1.Recordset.AddNew
Adodc1.Recordset.Update
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.MoveNext
Adodc1.Recordset.Delete

I understand how to connect to the database, set up the data
adapter, create a dataset, but USING any of this data in a practical
way seemed way beyond the knowledge of the instructor.


There are no connected Recordsets anymore. There is also no record pointer
anymore.

The result of a query can be read into a DataTable. You can access any
record in the DataTable by specifying the index of the record within the
DataTable.

A "replacement" for AddNew is the NewRow function of the DataTable. It
creates (surprise) a new row (=record). Then add the new row to the Rows
collection of the DataTable.
Calling the updating method of a DataAdapter synchronizes the DataTable with
the table in the database: Records added to the Datatable are inserted in
the database, records deleted are also deleted in the database, and modified
records are updated in the database. That's all done by Insert-, Update-,
and Delete-SQL statements executed by the DataAdapter.

But, why not read the ADO.NET documentation? There it is all explained in
detail.

http://msdn.microsoft.com/library/en...tingDataVB.asp
http://msdn.microsoft.com/library/en...withadonet.asp

For further ADO.NET related questions please turn to
microsoft.public.dotnet.framework.adonet.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
Cor
Hi Tony,

I do this in addition to the answer from Armin

In my opinion also is the documentation is very much build on datareaders,
wizard and very few on using the dataset and the datatable.

I think because you are writing about the dataadapter you are talking about
the dataset and not the recordset. The answers are only ment to help you to
come on the route, and not complete just a comparising with the recordset
methods
Adodc1.Recordset.AddNew dataset.tables(0).rows.add(dataset.tables(0).newro w)
Adodc1.Recordset.Update Dataadapter.update(dataset)
and beter is
Dataadapter.update(dataset.getchanges)
and even beter is
if dataset.haschanges
dataadapter.update(dataset.getchanges)
end if
(check what commando's you use with the dataset. there is a big difference
by instance with remove and delete, a removed datarow will not be updated).
Adodc1.Recordset.MoveFirst dataset.tables(0).rows(0).item(0) is the first item in the first row.
Adodc1.Recordset.MoveNext dataset.tables(0).rows(1).item(0) is the first item in the second row

Adodc1.Recordset.Delete
dataset.tables(0).rows(0).delete delete the first row

Is it not easy?

Cor

I understand how to connect to the database, set up the data adapter,
create a dataset, but USING any of this data in a practical way seemed
way beyond the knowledge of the instructor.

Thanks

Nov 20 '05 #3
<to**************@hotmail.com> schrieb

Adodc1.Recordset.AddNew
Adodc1.Recordset.Update
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.MoveNext
Adodc1.Recordset.Delete


Now I see you used a data control and are referring to data bound controls.
I can only provide a link for this:
http://msdn.microsoft.com/library/en...chitecture.asp
Still the other group mentioned is the better place to ask. For data binding
questions there is also
microsoft.public.dotnet.framework.windowsforms.dat abinding
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4
Cor
Hi Tony,

Before you understand this wrong,
In my opinion also is the documentation is very much build on datareaders,
wizard and very few on using the dataset and the datatable.


There is a lot of documentation about datasets and datatables in/on MSDN,
only in my opinion are the first pointers, specialy with walkthroughs and
things like that, very oriented onto wizards and datareaders.

But when you search you can find it

Cor
Nov 20 '05 #5
Hi,

VBTV episode 4 has some good info on ADO.NET
http://msdn.microsoft.com/vbtv/

Ken
-------------------
<to**************@hotmail.com> wrote in message
news:n4********************************@4ax.com...

I just spent 4 months taking a dotnet class where i learned very
little. One of the things I did not learn is this: What are the
dotnet equivilents of commands such as:

Adodc1.Recordset.AddNew
Adodc1.Recordset.Update
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.MoveNext
Adodc1.Recordset.Delete

I understand how to connect to the database, set up the data adapter,
create a dataset, but USING any of this data in a practical way seemed
way beyond the knowledge of the instructor.

Thanks

Nov 20 '05 #6

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

Similar topics

11
by: Ian Ornstein | last post by:
in posting http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&newwindow=1&selm=bmEK9.43452%24lj.1060600%40read1.cgocable.net Lyle showed us that an ADODB.Recordset can be created and attached to a...
22
by: Gerry Abbott | last post by:
Hi all, I having some confusing effects with recordsets in a recent project. I created several recordsets, each set with the same number of records, and related with an index value. I create...
3
by: Nathan Bloomfield | last post by:
Hi there, I am having difficulty with a piece of code which would work wonders for my application if only the error trapping worked properly. Basically, it works as follows: - adds records...
13
by: Jan | last post by:
Hi I have a database that I use to keep track of the sales promotions that we send to companies. I normally send a mailing based on a subset of the companies in the database (found using the...
2
by: ThurstonHowl | last post by:
Hello, my task is the following: Input are tables with fields containing strings where the strings are actually delimited lists. For example, one field could contain 'AB|CD|EF|GH' I've...
4
by: darkforcesjedi | last post by:
Creating a connectionless recordset in ADO is simple enough, but how do you do it in DAO? I want a recordset stored in memory so I can filter/sort it easily. If I create a table I can make it work,...
0
ADezii
by: ADezii | last post by:
When you create an ADO Recordset, you should have some idea as to what functionality the Recordset does/does not provide. Some critical questions may, and should, be: Can I add New Records to the...
1
by: anniefs | last post by:
hi help me i m so much stuck int he code and i have no time .... i used ASP VBscipt and javascript functions with MS database javascript function add records in MS DB by using ASP vbscript...
6
by: Oko | last post by:
I'm currently developing an MS Access Data Project (.adp) in MS Access 2002. One of the reports within the DB uses data that is Dynamic and cannot be stored on the SQL Server. To resolve this, I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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...
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?

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.