C# School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a C# Expert!

Join 300,462 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,663 people online right now. Registration is fast and FREE... Join Now!




ADO.NET DataSet + DataAdapter

 

ADO.NET DataSet + DataAdapter

Braindead

25 Jun, 2009 - 09:43 AM
Post #1

New D.I.C Head
*

Joined: 21 Jun, 2009
Posts: 9


My Contributions
Hi smile.gif

I'm new to database programming in C#.

So here is my question.

I have a database with a couple of tables for my little tool.

Now, I want to load all these data in a DataSet. But how to?

After setup and opening connection I use the DataAdapter.

SqlCeDataAdapter DA = new SqlCeDataAdapter("SELECT * FROM XList", conn);

Is this the correct command for it?

But how can I access the different tables?

If not, how can I load all tables in my DataSet?

Hope, you understand what I mean and it's not to easy ph34r.gif .

Any help would be great cool.gif



User is offlineProfile CardPM
+Quote Post


newProgram

RE: ADO.NET DataSet + DataAdapter

25 Jun, 2009 - 06:10 PM
Post #2

D.I.C Head
**

Joined: 28 Oct, 2008
Posts: 152



Thanked: 4 times
My Contributions
QUOTE(Braindead @ 25 Jun, 2009 - 09:43 AM) *

Hi smile.gif

I'm new to database programming in C#.

So here is my question.

I have a database with a couple of tables for my little tool.

Now, I want to load all these data in a DataSet. But how to?

After setup and opening connection I use the DataAdapter.

SqlCeDataAdapter DA = new SqlCeDataAdapter("SELECT * FROM XList", conn);

Is this the correct command for it?

But how can I access the different tables?

If not, how can I load all tables in my DataSet?

Hope, you understand what I mean and it's not to easy ph34r.gif .

Any help would be great cool.gif

What database are you using? If you are using SQL Server then you will use SqlDataAdapter, for MySQL it is OdbcDataAdapter.

Try this one:
CODE

SqlDataAdapter da = new SqlDataAdapter(SELECT * FROM XList", conn);
DataSet ds = new DataSet();
da.Fill(ds);

User is offlineProfile CardPM
+Quote Post

Braindead

RE: ADO.NET DataSet + DataAdapter

30 Jun, 2009 - 07:18 AM
Post #3

New D.I.C Head
*

Joined: 21 Jun, 2009
Posts: 9


My Contributions
Fine, now it works perfect icon_up.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 02:20AM

Live C# Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month