469,269 Members | 1,006 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,269 developers. It's quick & easy.

Debugging Immediate Window

Hey all,

when i'm in debug mode, is there a way to get to a certain record in a
dataset (say like in the Immediate window or something)?

thanks,
rodchar
Nov 21 '05 #1
7 5580

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:A3**********************************@microsof t.com...
Hey all,

when i'm in debug mode, is there a way to get to a certain record in a
dataset (say like in the Immediate window or something)?

thanks,
rodchar


Yep. Asumming you've breakpointed your way into debug mode at the scope of the datset is such that
it is "alive" when your break point is hit you can use the Immediate window to :

? MyDataset.Tables.Count

...... you can do anything you like here

Note the ? is very imkportant as it asks a question which returns a result. You can also make
assignment by dropping the ?.

MyDataset.Tables(0).Rows(0)(1) = "Assign value"

hth
Richard
Nov 21 '05 #2
This will return the datarow in the command window
?me.dsFleet.Tables(0).Rows(0) ' first table, firstrow

To return the datacolumn
?me.dsFleet.Tables("Customers").Rows(2)("Address") ' customer table, third
row, address datacolumn

--
Walt Ritscher
www.waltritscher.com\blogs
www.scandiasoft.com
yahoo email account is a spam trap - I will not reply to any mail sent to
this address.
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:A3**********************************@microsof t.com...
Hey all,

when i'm in debug mode, is there a way to get to a certain record in a
dataset (say like in the Immediate window or something)?

thanks,
rodchar

Nov 21 '05 #3
Richard Myers wrote:
? MyDataset.Tables.Count

..... you can do anything you like here

Note the ? is very imkportant as it asks a question which returns a result. You can also make
assignment by dropping the ?.


Note that the use of a question mark to get the Basic language to print
something goes back to the late 1970's. If you entered "?" in your Quick
Basic program, it would be converted to "PRINT" automatically.

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..
Nov 21 '05 #4
> Note that the use of a question mark to get the Basic language to print
something goes back to the late 1970's. If you entered "?" in your Quick
Basic program, it would be converted to "PRINT" automatically.


Now thats legacy code!
I wonder if "?" still wears flares?

Nov 21 '05 #5
But what if I didn't know what the record number was. Let's say in a dataset
of 500 records I want to look at a record where a field = a specific value.
Kinda like, querying it in debug mode, is that possible?

"rodchar" wrote:
Hey all,

when i'm in debug mode, is there a way to get to a certain record in a
dataset (say like in the Immediate window or something)?

thanks,
rodchar

Nov 21 '05 #6
Awesome, thank you.

"Richard Myers" wrote:

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:22**********************************@microsof t.com...
But what if I didn't know what the record number was. Let's say in a dataset
of 500 records I want to look at a record where a field = a specific value.
Kinda like, querying it in debug mode, is that possible?


? MyDataset.MyTable.Select("CustomerId=5").Length

Will give the number of rows satifying the filter condition.

If you want to display the row

? MyDataset.MyTable.Select("CustomerId=5")(0)

Would return the first rowin the array of return rows that satisfied the criteria of the filter
condition. If you are using a untyped dataset you will get a bunch of lines about

Item: <cannot view indexed property>

so you will have to further refine your search

? MyDataset.MyTable.Select("CustomerId=5")(0)("My Property")

If you are using typed datasets your own version of the query below should pull up enough info to be
of use

? ctype(_customers.Customer.Select("CustomerId=90004 ")(0), dsCustomer.CustomerRow)

Here i am querying the Customer table in a dataset called _customer which is of type dsCustomer for
all rows which have a customerId of 90004. This will return an array of datarows;of which i am
casting the first from the base type of datarow as returned by the select method to the strongly
typed dsCustomer.CustomerRow:

Assumming a row matching this criteria is found the immediate window will return a list of field
values for this particular row:

{dsCustomer.CustomerRow}
AKey: "fffffff"
CustomerId: 90004
DCity: <error: an exception of type: {System.Data.StrongTypingException} occurred>
DCountry: <error: an exception of type: {System.Data.StrongTypingException} occurred>
DStateRegion: <error: an exception of type: {System.Data.StrongTypingException} occurred>
DStreet1: <error: an exception of type: {System.Data.StrongTypingException} occurred>
DStreet2: <error: an exception of type: {System.Data.StrongTypingException} occurred>
DSuburb: <error: an exception of type: {System.Data.StrongTypingException} occurred>
DZipcode: <error: an exception of type: {System.Data.StrongTypingException} occurred>
Email: <error: an exception of type: {System.Data.StrongTypingException} occurred>
Fax: <error: an exception of type: {System.Data.StrongTypingException} occurred>
HasErrors: False
Item: <cannot view indexed property>
Item: <cannot view indexed property>
Item: <cannot view indexed property>
Item: <cannot view indexed property>
ItemArray: {Length=26}
Name: "Rodger Bannister"
PCity: <error: an exception of type: {System.Data.StrongTypingException} occurred>
PCountry: <error: an exception of type: {System.Data.StrongTypingException} occurred>
Phone1: "021 240 7444"
Phone2: <error: an exception of type: {System.Data.StrongTypingException} occurred>
PhoneFree: <error: an exception of type: {System.Data.StrongTypingException} occurred>
PStateRegion: <error: an exception of type: {System.Data.StrongTypingException} occurred>
PStreet1: <error: an exception of type: {System.Data.StrongTypingException} occurred>
PStreet2: <error: an exception of type: {System.Data.StrongTypingException} occurred>
PSuburb: <error: an exception of type: {System.Data.StrongTypingException} occurred>
PZipcode: <error: an exception of type: {System.Data.StrongTypingException} occurred>
RowError: ""
RowState: Unchanged
SalesCallStatus: 4
SalesRoute: 2
SalesTerritoryId: 3
Table: {dsCustomer.CustomerDataTable}
Website: <error: an exception of type: {System.Data.StrongTypingException} occurred>
Anything like <error: an exception of type: {System.Data.StrongTypingException} occurred> generally
means that the strongly typed dataset contains a value of Null for that field.

hth
Richard

Nov 21 '05 #7
Awesome, thank you.

"Richard Myers" wrote:

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:22**********************************@microsof t.com...
But what if I didn't know what the record number was. Let's say in a dataset
of 500 records I want to look at a record where a field = a specific value.
Kinda like, querying it in debug mode, is that possible?


? MyDataset.MyTable.Select("CustomerId=5").Length

Will give the number of rows satifying the filter condition.

If you want to display the row

? MyDataset.MyTable.Select("CustomerId=5")(0)

Would return the first rowin the array of return rows that satisfied the criteria of the filter
condition. If you are using a untyped dataset you will get a bunch of lines about

Item: <cannot view indexed property>

so you will have to further refine your search

? MyDataset.MyTable.Select("CustomerId=5")(0)("My Property")

If you are using typed datasets your own version of the query below should pull up enough info to be
of use

? ctype(_customers.Customer.Select("CustomerId=90004 ")(0), dsCustomer.CustomerRow)

Here i am querying the Customer table in a dataset called _customer which is of type dsCustomer for
all rows which have a customerId of 90004. This will return an array of datarows;of which i am
casting the first from the base type of datarow as returned by the select method to the strongly
typed dsCustomer.CustomerRow:

Assumming a row matching this criteria is found the immediate window will return a list of field
values for this particular row:

{dsCustomer.CustomerRow}
AKey: "fffffff"
CustomerId: 90004
DCity: <error: an exception of type: {System.Data.StrongTypingException} occurred>
DCountry: <error: an exception of type: {System.Data.StrongTypingException} occurred>
DStateRegion: <error: an exception of type: {System.Data.StrongTypingException} occurred>
DStreet1: <error: an exception of type: {System.Data.StrongTypingException} occurred>
DStreet2: <error: an exception of type: {System.Data.StrongTypingException} occurred>
DSuburb: <error: an exception of type: {System.Data.StrongTypingException} occurred>
DZipcode: <error: an exception of type: {System.Data.StrongTypingException} occurred>
Email: <error: an exception of type: {System.Data.StrongTypingException} occurred>
Fax: <error: an exception of type: {System.Data.StrongTypingException} occurred>
HasErrors: False
Item: <cannot view indexed property>
Item: <cannot view indexed property>
Item: <cannot view indexed property>
Item: <cannot view indexed property>
ItemArray: {Length=26}
Name: "Rodger Bannister"
PCity: <error: an exception of type: {System.Data.StrongTypingException} occurred>
PCountry: <error: an exception of type: {System.Data.StrongTypingException} occurred>
Phone1: "021 240 7444"
Phone2: <error: an exception of type: {System.Data.StrongTypingException} occurred>
PhoneFree: <error: an exception of type: {System.Data.StrongTypingException} occurred>
PStateRegion: <error: an exception of type: {System.Data.StrongTypingException} occurred>
PStreet1: <error: an exception of type: {System.Data.StrongTypingException} occurred>
PStreet2: <error: an exception of type: {System.Data.StrongTypingException} occurred>
PSuburb: <error: an exception of type: {System.Data.StrongTypingException} occurred>
PZipcode: <error: an exception of type: {System.Data.StrongTypingException} occurred>
RowError: ""
RowState: Unchanged
SalesCallStatus: 4
SalesRoute: 2
SalesTerritoryId: 3
Table: {dsCustomer.CustomerDataTable}
Website: <error: an exception of type: {System.Data.StrongTypingException} occurred>
Anything like <error: an exception of type: {System.Data.StrongTypingException} occurred> generally
means that the strongly typed dataset contains a value of Null for that field.

hth
Richard

Nov 21 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by rodchar | last post: by
15 posts views Thread by Darren Gulliver | last post: by
2 posts views Thread by James | last post: by
23 posts views Thread by keyser_Soze | last post: by
3 posts views Thread by jsh02_nova | last post: by
4 posts views Thread by cj | last post: by
reply views Thread by Armin Zingler | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.