473,805 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Working with a single record resultset vs multi record

Hi,

In all my coding to date, i have been dealing with multiple results in my
dataset, looping through them with

SqlDataAdapterC ontactProfile.F ill(contact, "Profile")

For Each pRow In contact.Tables( "Profile"). Rows

label1.text = prow("fieldname ")

Next
I now have a situation where I only return a single record, and want to know
how i should deal with this situation. There is no point having a for each
loop
as there is only the one row.

What code should I have so that I can access the single record result set

Thanks
Jun 5 '07 #1
6 2501
Aussie Rules wrote:
Hi,

In all my coding to date, i have been dealing with multiple results in my
dataset, looping through them with
You mean a single result with multiple rows. Multiple results would mean
that you would have multiple Table objects in the DataSet.
SqlDataAdapterC ontactProfile.F ill(contact, "Profile")

For Each pRow In contact.Tables( "Profile"). Rows

label1.text = prow("fieldname ")

Next
I now have a situation where I only return a single record, and want to
know
how i should deal with this situation. There is no point having a for
each loop
as there is only the one row.

What code should I have so that I can access the single record result set
Just access the first row (index 0):

label1.Text = contact.Tables( "Profile").Rows (0).Item("field name")

or

label1.Text = contact.Tables( "Profile").Rows (0)("fieldname" )
If you want to access more than one field, you might want to create a
reference to the row:

Dim profile As DataRow = contact.Tables( "Profile").Rows (0)
label1.Text = profile("fieldn ame")

--
Göran Andersson
_____
http://www.guffa.com
Jun 5 '07 #2
Aussie Rules wrote:
Hi,

In all my coding to date, i have been dealing with multiple results in my
dataset, looping through them with

SqlDataAdapterC ontactProfile.F ill(contact, "Profile")

For Each pRow In contact.Tables( "Profile"). Rows

label1.text = prow("fieldname ")

Next
I now have a situation where I only return a single record, and want to
know
how i should deal with this situation. There is no point having a for
each loop
as there is only the one row.

What code should I have so that I can access the single record result set
I think this link will put you into the ballpark.

<http://www.aspfree.com/c/a/MS-SQL-Server/Pulling-Information-using-DataAdapter-with-ADONET/2/>

http://preview.tinyurl.com/ysos8p
Jun 5 '07 #3
Darnold

There are AFAIK only two methods to Find a row. That is using the DataView
which returns the position in the dataview and the find in the
datarowcollecti on which returns a datarow.
All others return a collection of rows.

http://www.vb-tips.com/dbpages.aspx?...d-13dccb86d378

I hope this helps,

Cor

"DArnold" <DA*****@DArnol d.comschreef in bericht
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Aussie Rules wrote:
>Hi,

In all my coding to date, i have been dealing with multiple results in my
dataset, looping through them with

SqlDataAdapter ContactProfile. Fill(contact, "Profile")

For Each pRow In contact.Tables( "Profile"). Rows

label1.text = prow("fieldname ")

Next
I now have a situation where I only return a single record, and want to
know
how i should deal with this situation. There is no point having a for
each loop
as there is only the one row.

What code should I have so that I can access the single record result set

I think this link will put you into the ballpark.

<http://www.aspfree.com/c/a/MS-SQL-Server/Pulling-Information-using-DataAdapter-with-ADONET/2/>

http://preview.tinyurl.com/ysos8p

Jun 5 '07 #4
Sorry,

This is not meant as a correction or whatever, just attached to the wrong
thread while your message was open, should have been to the main thread.

Cor

"Cor Ligthert [MVP]" <no************ @planet.nlschre ef in bericht
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
Darnold

There are AFAIK only two methods to Find a row. That is using the DataView
which returns the position in the dataview and the find in the
datarowcollecti on which returns a datarow.
All others return a collection of rows.

http://www.vb-tips.com/dbpages.aspx?...d-13dccb86d378

I hope this helps,

Cor

"DArnold" <DA*****@DArnol d.comschreef in bericht
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>Aussie Rules wrote:
>>Hi,

In all my coding to date, i have been dealing with multiple results in
my
dataset, looping through them with

SqlDataAdapte rContactProfile .Fill(contact, "Profile")

For Each pRow In contact.Tables( "Profile"). Rows

label1.text = prow("fieldname ")

Next
I now have a situation where I only return a single record, and want to
know
how i should deal with this situation. There is no point having a for
each loop
as there is only the one row.

What code should I have so that I can access the single record result
set

I think this link will put you into the ballpark.

<http://www.aspfree.com/c/a/MS-SQL-Server/Pulling-Information-using-DataAdapter-with-ADONET/2/>

http://preview.tinyurl.com/ysos8p


Jun 5 '07 #5
Cor Ligthert [MVP] wrote:
Darnold

There are AFAIK only two methods to Find a row. That is using the DataView
which returns the position in the dataview and the find in the
datarowcollecti on which returns a datarow.
All others return a collection of rows.

http://www.vb-tips.com/dbpages.aspx?...d-13dccb86d378

I hope this helps,

Cor
Perhaps you replied in the wrong thread? He's not trying to find
anything at all. He only has a single row, so it's not very hard to find
it...
"DArnold" <DA*****@DArnol d.comschreef in bericht
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>Aussie Rules wrote:
>>Hi,

In all my coding to date, i have been dealing with multiple results in my
dataset, looping through them with

SqlDataAdapte rContactProfile .Fill(contact, "Profile")

For Each pRow In contact.Tables( "Profile"). Rows

label1.text = prow("fieldname ")

Next
I now have a situation where I only return a single record, and want to
know
how i should deal with this situation. There is no point having a for
each loop
as there is only the one row.

What code should I have so that I can access the single record result set
I think this link will put you into the ballpark.

<http://www.aspfree.com/c/a/MS-SQL-Server/Pulling-Information-using-DataAdapter-with-ADONET/2/>
>>
http://preview.tinyurl.com/ysos8p


--
Göran Andersson
_____
http://www.guffa.com
Jun 5 '07 #6
You are right

"Göran Andersson" <gu***@guffa.co mschreef in bericht
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Cor Ligthert [MVP] wrote:
>Darnold

There are AFAIK only two methods to Find a row. That is using the
DataView which returns the position in the dataview and the find in the
datarowcollect ion which returns a datarow.
All others return a collection of rows.

http://www.vb-tips.com/dbpages.aspx?...d-13dccb86d378

I hope this helps,

Cor

Perhaps you replied in the wrong thread? He's not trying to find anything
at all. He only has a single row, so it's not very hard to find it...
>"DArnold" <DA*****@DArnol d.comschreef in bericht
news:%2******* *********@TK2MS FTNGP04.phx.gbl ...
>>Aussie Rules wrote:
Hi,

In all my coding to date, i have been dealing with multiple results in
my
dataset, looping through them with

SqlDataAdapt erContactProfil e.Fill(contact, "Profile")

For Each pRow In contact.Tables( "Profile"). Rows

label1.text = prow("fieldname ")

Next
I now have a situation where I only return a single record, and want to
know
how i should deal with this situation. There is no point having a for
each loop
as there is only the one row.

What code should I have so that I can access the single record result
set
I think this link will put you into the ballpark.

<http://www.aspfree.com/c/a/MS-SQL-Server/Pulling-Information-using-DataAdapter-with-ADONET/2/>
>>>
http://preview.tinyurl.com/ysos8p



--
Göran Andersson
_____
http://www.guffa.com

Jun 6 '07 #7

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

Similar topics

4
3067
by: googlinggoogler | last post by:
Hiya, The title says it all really, but im a newbie to python sort of. I can read in files and write files no probs. But what I want to do is read in a couple of files and output them to one single file, but then be able to take this one single file and recreate the files I put into it. Im really at a loss as to how I go about recovering the files?
17
3385
by: Gabriel Mejía | last post by:
Services or applications using ActiveX Data Objects (ADO) 2.0 or greater may intermittently return empty recordsets on queries that should be returning valid results. At the time the problem occurs, the same queries successfully return the expected data when run from non-ADO sources, such as from ISQL in Microsoft SQL Server. This problem predominantly occurs on multi-processor computers but has also been known to occur on single-processor...
2
13632
by: eeh | last post by:
Hi, Suppose I have a table "product" with fields id,name,price. I want to get a resultset of previous and current and next record when the resultset is sorted by id and id=10. The table data is shown in the following: id Name Price 1 : : 5 : :<--------------previous record
3
2270
by: Paul Janssen | last post by:
Hello! Can anyone help me out with the following situation: (a) a single query with 550 id's in the IN-clause resulting into 800+ seconds; (b) 550 queries with a single id in the IN-clause resulting into overall time of <60 seconds; The table consists of 950.000 records, and the resultset consists of 205.000 records.
3
9198
by: canigou9 (remove your socks to reply) | last post by:
(cross posted - comp.databases.ms-access, microsoft.public.access) Hello folks - this is my first post here, after a short lurk. I have written an application in Access2002 for a friend's business which allows him to take orders, arrange deliveries and trace deliveries back in the event of subsequent complaints. It uses a handful of tables in a relational schema, with a few ancillary lookup tables, some forms, reports and VBA modules.
24
4048
by: Salad | last post by:
Every now and then I see ads that state something like "Experience with Large Databases ...multi-gig...blah-de-blah" And I have to laugh. What's the difference between a large or small database? A table is a table, a record is a record, a field is a field. All you are doing is manipulating data in tables. I wouldn't think it'd make much difference in working with a table with 10 records or a billion records...they're nothing more than...
2
2292
by: Bob | last post by:
This is the snippet of code Dim myConnString As String = "Integrated Security=SSPI;Packet Size=4096;Data Source=MyServer;" & _ "Initial Catalog=MyDatabase; " & _ "Persist Security Info=False;" & _ "Workstation ID=MyWS"
26
3165
by: Jimmy | last post by:
ill have a database with 1 table and 3 fields: ID FIRSTNAME LASTNAME (the ID field will be the auto incrementing index) there might be 10 records in the DB, there might be 10,000. i need to open the DB and randomly select a record (and then display the name, which i dont have a problem with) how can i randomly select a record? im guessing id have to open a recordset
0
1653
by: loken0673 | last post by:
Hello All I want to Split multirow resultset to single row, multicolumn resultset my table is ProfileDetail(ProfileId bigint, PropertyId bigint PropertyValue nvarchar(400)) Table data : ProfileId PropertyId PropertyValue 97 1 lokendra
0
9718
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
10613
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
10368
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
9186
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
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
5544
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
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4327
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 we have to send another system

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.