Click here to Skip to main content
15,881,882 members
Home / Discussions / C#
   

C#

 
GeneralRe: Datagrid and c# Pin
Heath Stewart16-Jan-04 19:29
protectorHeath Stewart16-Jan-04 19:29 
QuestionEditboxes show unknown chars as ?? Pin
Anonymous16-Jan-04 14:02
Anonymous16-Jan-04 14:02 
AnswerRe: Editboxes show unknown chars as ?? Pin
LiquidKnight16-Jan-04 14:06
LiquidKnight16-Jan-04 14:06 
AnswerRe: Editboxes show unknown chars as ?? Pin
Heath Stewart16-Jan-04 19:22
protectorHeath Stewart16-Jan-04 19:22 
GeneralGive name to table from stored procedure Pin
laphijia16-Jan-04 8:29
laphijia16-Jan-04 8:29 
GeneralRe: Give name to table from stored procedure Pin
Rocky Moore16-Jan-04 8:44
Rocky Moore16-Jan-04 8:44 
GeneralRe: Give name to table from stored procedure Pin
Guillermo Rivero16-Jan-04 12:51
Guillermo Rivero16-Jan-04 12:51 
GeneralRe: Give name to table from stored procedure Pin
Heath Stewart16-Jan-04 19:18
protectorHeath Stewart16-Jan-04 19:18 
When using DataSets, try designing a strongly-typed DataSet by using the DataSet designer in VS.NET (there are other ways and tools, too, but I present the way in VS.NET). Right-click on your project or subfolder and select Add New Item. Find DataSet, give it a name, and click OK.

You'll see a component designer screen. Right-click to add elements (tables) and each element has rows and their types (the columns). You can even add relationships and primary keys. Just play around with it a little.

You can even use the Server Explorer if you have a database connection to drag-n-drop tables or stored procedures which returns tables to generate these automatically.

When you fill the strongly-typed DataSet, your DbDataAdapter derivative (like SqlDataAdapter) has to be configured to map the tables. This is done through DbDataAdapter.TableMappings and can easily be configured by using the data adapter designer in VS.NET as well.

Finally, you don't even need to use strongly-typed if you use the TableMappings property mentioned above. When selecting multiple result sets, the sequence of table names is "Table", "Table1", "Table2", etc. If you map these to other names, you can use DataSet.Tables["nameOfTable"].

I recommend using strongly-typed DataSets, though. You can easily refer to columns by name and don't have to worry about casting since those named rows return the appropriate Type.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralLearned something new.. Pin
Rocky Moore16-Jan-04 8:14
Rocky Moore16-Jan-04 8:14 
GeneralRe: Learned something new.. Pin
Mazdak16-Jan-04 8:22
Mazdak16-Jan-04 8:22 
GeneralRe: Learned something new.. Pin
leppie16-Jan-04 9:01
leppie16-Jan-04 9:01 
QuestionHow to test Microphone, Pin
Shahin7716-Jan-04 6:57
Shahin7716-Jan-04 6:57 
AnswerRe: How to test Microphone, Pin
Hauptman(n)16-Jan-04 7:25
Hauptman(n)16-Jan-04 7:25 
GeneralRe: How to test Microphone, Pin
eggie516-Jan-04 11:39
eggie516-Jan-04 11:39 
GeneralRe: How to test Microphone, Pin
Guillermo Rivero16-Jan-04 12:09
Guillermo Rivero16-Jan-04 12:09 
GeneralRe: How to test Microphone, Pin
Hauptman(n)17-Jan-04 0:47
Hauptman(n)17-Jan-04 0:47 
Generalseting focus on a control Pin
elena1234516-Jan-04 6:54
elena1234516-Jan-04 6:54 
GeneralRe: seting focus on a control Pin
Heath Stewart16-Jan-04 7:11
protectorHeath Stewart16-Jan-04 7:11 
Question.NET Bug or bad code ? Pin
Guinness4Strength16-Jan-04 5:11
Guinness4Strength16-Jan-04 5:11 
AnswerRe: .NET Bug or bad code ? Pin
Daniel Turini16-Jan-04 5:20
Daniel Turini16-Jan-04 5:20 
GeneralRe: .NET Bug or bad code ? Pin
Guinness4Strength16-Jan-04 5:29
Guinness4Strength16-Jan-04 5:29 
GeneralRe: .NET Bug or bad code ? Pin
Heath Stewart16-Jan-04 5:42
protectorHeath Stewart16-Jan-04 5:42 
AnswerRe: .NET Bug or bad code ? Pin
Heath Stewart16-Jan-04 5:38
protectorHeath Stewart16-Jan-04 5:38 
GeneralRe: .NET Bug or bad code ? Pin
Guinness4Strength16-Jan-04 5:40
Guinness4Strength16-Jan-04 5:40 
QuestionDateTime convert ? Pin
Dr Dead16-Jan-04 3:14
sussDr Dead16-Jan-04 3:14 

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.