473,574 Members | 3,169 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 2488
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
3048
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...
17
3369
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...
2
13618
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
2247
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
9183
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...
24
4012
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...
2
2282
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
3131
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...
0
1634
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
8234
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7815
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...
0
8098
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6452
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...
1
5620
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...
0
3740
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...
1
2243
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
1
1339
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1060
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.