Home All Groups Group Topic Archive Search About

how to check if the dataset is EOF or if a record exists frist .

Author
28 Dec 2006 3:01 PM
Andrew
how to check if the dataset is EOF or if a record exists frist in ADO.NET and
vb2005:

Dim conn As New SqlConnection("User ID=sa; password=apw!pain; Initial
Catalog=APW_SYSTEM;Data Source=paradigm")
        Dim sqlstr As String = "SELECT * FROM sysMaster WHERE sysName =
'IT_1'"
        Dim da As SqlDataAdapter = New SqlDataAdapter(sqlstr, conn)
        Dim ds As New DataSet

MessageBox.Show(ds.Tables(0).Rows(0).Item("sysName").ToString)

ds.dispose()

Author
28 Dec 2006 4:12 PM
Rad [Visual C# MVP]
On Thu, 28 Dec 2006 07:01:00 -0800, Andrew wrote:

> ds.Tables(0).Rows

You can check the rowcount

If ds.Tables(0).Rows.Count > 1 then

'
' do your stuff here
'

End If
Author
28 Dec 2006 4:40 PM
Andrew
thanks, I was counting the records witch is alttle bit longer to do..

Show quoteHide quote
"Rad [Visual C# MVP]" wrote:

> On Thu, 28 Dec 2006 07:01:00 -0800, Andrew wrote:
>
> > ds.Tables(0).Rows
>
> You can check the rowcount
>
> If ds.Tables(0).Rows.Count > 1 then
>
> '
> ' do your stuff here
> '
>
> End If
> --
> Bits.Bytes
> http://bytes.thinkersroom.com
>
Author
28 Dec 2006 6:15 PM
RobinS
Don't you mean

If ds.Tables(0).Rows.Count >= 1 Then

?

Robin S.
------------------------
Show quoteHide quote
"Rad [Visual C# MVP]" <nospam@nospam.com> wrote in message
news:v8fr5x3xlgpw.dlg@thinkersroom.com...
> On Thu, 28 Dec 2006 07:01:00 -0800, Andrew wrote:
>
>> ds.Tables(0).Rows
>
> You can check the rowcount
>
> If ds.Tables(0).Rows.Count > 1 then
>
> '
> ' do your stuff here
> '
>
> End If
> --
> Bits.Bytes
> http://bytes.thinkersroom.com
Author
28 Dec 2006 7:46 PM
Rad [Visual C# MVP]
On Thu, 28 Dec 2006 10:15:19 -0800, RobinS wrote:

> Don't you mean
>
> If ds.Tables(0).Rows.Count >= 1 Then
>
> ?
>
> Robin S.

Oops. My bad. Of course >= 1. Mind was poisoned by the fact that i was
working on something with similar logic that needed two records.

Author
28 Dec 2006 8:54 PM
RobinS
Show quote Hide quote
"Rad [Visual C# MVP]" <nospam@nospam.com> wrote in message
news:o5ts5ze17hbz.dlg@thinkersroom.com...
> On Thu, 28 Dec 2006 10:15:19 -0800, RobinS wrote:
>
>> Don't you mean
>>
>> If ds.Tables(0).Rows.Count >= 1 Then
>>
>> ?
>>
>> Robin S.
>
> Oops. My bad. Of course >= 1. Mind was poisoned by the fact that i was
> working on something with similar logic that needed two records.
>
> --
> Bits.Bytes
> http://bytes.thinkersroom.com


A-HA!! Your mind has a dual core processor. Cool.

Robin S.
Author
28 Dec 2006 9:22 PM
Rad [Visual C# MVP]
On Thu, 28 Dec 2006 12:54:31 -0800, RobinS wrote:


Show quoteHide quote
>
> A-HA!! Your mind has a dual core processor. Cool.
>
> Robin S.

:( I wish! More like a 286

Author
29 Dec 2006 4:20 AM
RobinS
Show quote Hide quote
"Rad [Visual C# MVP]" <nospam@nospam.com> wrote in message
news:1czir8jyozf9p$.dlg@thinkersroom.com...
> On Thu, 28 Dec 2006 12:54:31 -0800, RobinS wrote:
>
>
>>
>> A-HA!! Your mind has a dual core processor. Cool.
>>
>> Robin S.
>
> :( I wish! More like a 286
>
> --
> Bits.Bytes
> http://bytes.thinkersroom.com


LOL. Personally, I'd like to install more memory!

Robin S.
Author
29 Dec 2006 5:31 AM
Bruce W. Darby
"Rad [Visual C# MVP]" <nospam@nospam.com> wrote in message
news:1czir8jyozf9p$.dlg@thinkersroom.com...
> :( I wish! More like a 286


At least it isn't a Tandy TRS-80. :) Where would you load the tape?????
Uh... Don't want to know!!! :)