Click here to Skip to main content
15,927,174 members
Home / Discussions / C#
   

C#

 
GeneralRe: Trapping abnormal process termination Pin
Bruce Duncan19-Mar-04 3:02
Bruce Duncan19-Mar-04 3:02 
GeneralRe: Trapping abnormal process termination Pin
Heath Stewart19-Mar-04 3:31
protectorHeath Stewart19-Mar-04 3:31 
GeneralRe: Trapping abnormal process termination Pin
Heath Stewart19-Mar-04 3:45
protectorHeath Stewart19-Mar-04 3:45 
Generalgrab a combo in another app... Pin
Jumpin' Jeff18-Mar-04 14:59
Jumpin' Jeff18-Mar-04 14:59 
GeneralRe: grab a combo in another app... Pin
Heath Stewart19-Mar-04 3:29
protectorHeath Stewart19-Mar-04 3:29 
GeneralRe: grab a combo in another app... Pin
Jumpin' Jeff19-Mar-04 8:18
Jumpin' Jeff19-Mar-04 8:18 
GeneralTyped Datasets Pin
Kant18-Mar-04 12:55
Kant18-Mar-04 12:55 
GeneralRe: Typed Datasets Pin
Heath Stewart18-Mar-04 13:31
protectorHeath Stewart18-Mar-04 13:31 
A typed DataSet is a class that is derived from DataSet that is "pre-configured" with your database schema. Other typed classes deriving from DataTable and other supporting classes are also defined as well.

Typed DataSets are very handy when using the designer in VS.NET for data-bound controls like the DataGrid because the designer can discover all your table and column names so you can bind to them easily. Simply open the toolbox, select the Data catagory, then drag a "DataSet" in. When it asks, choose to create a typed DataSet from the list (if it's defined in your project) or click "Referenced Projects..." to find typed DataSets in projects that the current project references.

Why are they better? Well, first you don't have to define all your tables and columns programmatically; they're already defined in your new class. Second, they're much faster depending on how you access data. Commonly, people will use code like this:
string s = (string)dataSet1.Tables["MyTable"].Rows[0]["ID"];
That is a very expensive call. First, the tables must be enumerated to find the one named "MyTable" (which includes expensive, case-insensitive string searches). Then the first row is obtained and the column with the name "ID" is found in a simiar fashion, except that columns are first enumerated and then the N'th row's data is retrieved.

When you use a typed DataSet and use code like the following, the lookups are not necessary because the tables and references columns are references to the tables and columns already instantiated - no lookups are required:
string s = myDataSet1.MyTable.Rows[0].ID;
Also notice I didn't have to cast to a string? While casting is done internally in the typed DataSet class, you don't have to worry about cast exceptions in your code, which is good encapsulation.

Finally, when you use the designer to generate a derivative DataAdapter, all the table and column mappings are done for you automatically.

While the benefits are great when using the VS.NET designers, the runtime benefits are good, too. Few to no lookups are required and it's easier to discover type information at runtime for abstract implementations.

 

Microsoft MVP, Visual C#
My Articles
GeneralMi Web Page en cache !!! Pin
ElJerry18-Mar-04 12:17
ElJerry18-Mar-04 12:17 
GeneralRe: Mi Web Page en cache !!! Pin
Heath Stewart18-Mar-04 13:34
protectorHeath Stewart18-Mar-04 13:34 
GeneralI've a little doubt about decimal fraction !! Pin
ElJerry18-Mar-04 12:07
ElJerry18-Mar-04 12:07 
GeneralRe: I've a little doubt about decimal fraction !! Pin
Christian Graus18-Mar-04 12:36
protectorChristian Graus18-Mar-04 12:36 
GeneralRe: I've a little doubt about decimal fraction !! Pin
Werdna18-Mar-04 16:13
Werdna18-Mar-04 16:13 
GeneralaxWebBrowser DocumentComplete Pin
Jasper4C#18-Mar-04 10:57
Jasper4C#18-Mar-04 10:57 
GeneralRe: axWebBrowser DocumentComplete Pin
John Fisher18-Mar-04 11:35
John Fisher18-Mar-04 11:35 
GeneralRe: axWebBrowser DocumentComplete Pin
Jasper4C#25-Mar-04 11:05
Jasper4C#25-Mar-04 11:05 
GeneralRe: axWebBrowser DocumentComplete Pin
John Fisher25-Mar-04 13:11
John Fisher25-Mar-04 13:11 
GeneralRe: axWebBrowser DocumentComplete Pin
Jasper4C#25-Mar-04 22:54
Jasper4C#25-Mar-04 22:54 
GeneralRe: axWebBrowser DocumentComplete Pin
John Fisher26-Mar-04 5:20
John Fisher26-Mar-04 5:20 
GeneralRe: axWebBrowser DocumentComplete Pin
Jasper4C#26-Mar-04 7:12
Jasper4C#26-Mar-04 7:12 
GeneralRe: axWebBrowser DocumentComplete Pin
John Fisher26-Mar-04 15:08
John Fisher26-Mar-04 15:08 
GeneralControl Confussion Pin
Matthew Hazlett18-Mar-04 10:27
Matthew Hazlett18-Mar-04 10:27 
GeneralRe: Control Confussion Pin
John Fisher18-Mar-04 10:38
John Fisher18-Mar-04 10:38 
GeneralRe: Control Confussion Pin
Heath Stewart18-Mar-04 13:41
protectorHeath Stewart18-Mar-04 13:41 
GeneralProblems with changing a controls Docking Programmatically Pin
Gomac18-Mar-04 9:47
Gomac18-Mar-04 9:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.