untyped and strongly typed Datatable [Resolved]

Posted by Ali under C# on 2/27/2010 | Views : 6130 | Status : [Member] | Replies : 5
Hi,
I have few questions regarding datatable

What is difference between untyped datatable and strongly typed datatable?

What are the benifits of strongly typed datatable? why shuld use it?

What is memory usage difference in case of untyped/strongly typed datatable/dataset?




Responses

Posted by: Abhi2434 on: 2/27/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down

Resolved
Yes, you are correct. There is no difference in terms of Strongly typed or untyped.
Strongly typed dataset has better grip from the programmers point of view, as you have a class to get the data rather than going trough the DataRows manually.

Advantages of Strongly typed datasets is usability. It defines a DataAdapter if you want. So updating to the database is not a big deal using Strongly typed datasets. While creating Reports, Strongly typed datasets comes very handy.

Strongly typed dataset is actually a collection of class. While working with OOPS, we find easier to handle with custom objects rather than going through DataRows. There are lots of other advantages as well. Use it, you will find the advantages yourself.

Both of them are using same memory if it is defined correctly. In case of UnTyped datasets, columns are treated as objects, but internally they are mapped with DbTypes. So it needs to Box itself while you need. In case of Strongly typed dataset, it box itself when data is retrieved. So Strongly typed are more typesafe.

I hope you are clear now.

www.abhisheksur.com

Ali, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi2434 on: 2/27/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
What do you mean by Stronger Datatable?

Are you talking about Strongly Typed DataTable ?
Strongly typed datatables are those whose schema is defined as XML file. So if you want to store data into a strongly typed dataset, it will try to parse the data into the available fields.

There is nothing to deal with memory in this case. Everything works the same way, only the thing is that the datatable is available in the context as Properties.
We create Strongly typed dataset using xsds.



www.abhisheksur.com

Ali, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ali on: 2/27/2010 [Member] Starter

Up
0
Down
Thanks for quick reply.

Please make me more clear

1-So you mean there is no memory usage differences, if i use strongly typed datatable/dataset or untyped datatable/dataset ?

2- which is faster? strongly typed or untyped

Ali, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ali on: 2/27/2010 [Member] Starter

Up
0
Down
Thanks a lot

Ali, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Elizas on: 5/3/2010 [Member] Starter

Up
0
Down
What : A loosely typed programming languages is typically one that does not require the data type of a variable to be explicitly stated.

Example : As in JavaScript we can declare var count = 1; which will automatically treat variable count as integer.

Advantage: The advantage of loosely typed is that we don't have to bother about the data type of the variable value and we have the benefit of changing the type of the variable at any instance of time.
Usage in C# : ASP.NET 3.5 gives a new keyword "var" which behaves similar to what "var" keyword seems to do in JavaScript. By using the var keyword we can implicitly convert to its originally data type.
So,
var firstName = "Aditya"; convert the data type of variable "firstName" to string data type implicitly.

Hope this would add value.Any suggestions are appreciated.
http://www.mindfiresolutions.com/Loosely-typed-C-917.php

Ali, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response