General discussion

Locked

.NET: Choosing a dataset

By MaryWeilage Editor ·
In this week's .NET e-newsletter, author Tony Patton examines dataset types to further clarify their differences. Do you find it confusing to determine which dataset to use? If so, will Tony Patton's advice in this e-newsletter help you make your decision? Share your thoughts on datasets.

If you aren't subscribed to the .NET e-newsletter, you can automatically subscribe to this free e-newsletter by pasting the following URL into your browser:
http://nl.com.com/MiniFormHandler?brand=builder &subs_channel=bldr_front_door&list_id=e605&tag=fb

* Please delete any extra spaces that appear when you paste this URL into your browser.

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Can have readable untyped datasets

by Thoro80 In reply to .NET: Choosing a dataset

Hi,

Your arguement against the readability of untyped datasets is not infact the case, as your while loop which indexes the columns by the location can be replaced by

While (rdr.Read())
Console.Write("Name: ")
Console.Write(rdr.Item("FirstName"))
Console.WriteLine(rdr.Item("LastName"))
End While

That way you have the advantage of an untyped dataset (and there are advantages) and it is still quite obvious which columns you are using.

And if performance is an issue you can do this.

Dim firstNameColumn As Integer = rdr.GetOrdinal("FirstName")
Dim lastNameColumn As Integer = rdr.GetOrdinal("LastName")

While (rdr.Read())
Console.Write("Name: ")
Console.Write(rdr.GetValue(firstNameColumn))
Console.WriteLine(rdr.GetValue(lastNameColumn))
End While

I agree that there are advantages and disadvantages to untyped and typed dataset, but I believe the important ones have nothing to do with readability and ease of coding using the IDE.

Chris

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums