ADO.Net >> Newbie question: Fill dataset will ALL tables from database

by pierrevr » Thu, 20 May 2004 23:14:01 GMT

I am a C# developer in ADO.NET and need assistance with a I assume simple question:

How do I get all the data from a database in a dataset? I want to be
able to open any kind of ODBC database and thus do not have any
knowledge of the names of the tables or fields contained in the
database. I could after a day of searching on the Internet not find
ONE example where you don't have to specify which tables you want your
dataset to be populated with.

Thanks in advance

ADO.Net >> Newbie question: Fill dataset will ALL tables from database

by Klas » Fri, 21 May 2004 01:57:41 GMT


There is an example in the Visual Studio help:

ms-help://MS.VSCC/MS.MSDNVS/ado270/htm/mdmthopenschemax.htm

ADO.Net >> Newbie question: Fill dataset will ALL tables from database

by jcelko212 » Fri, 21 May 2004 10:36:08 GMT

>> I want to be able to open any kind of ODBC database and thus do
not have any knowledge of the names of the tables or fields [sic]
contained in the database. <<

You can get to the schema information tables and read them, since they
have standardized names and structures, then you use them to discover
the stuff in the database. It is insanely complicated. The best
answer is that you actually should know what you are doing before you
do it.

ADO.Net >> Newbie question: Fill dataset will ALL tables from database

by Cor Ligthert » Fri, 21 May 2004 15:43:47 GMT

Hi Piere,

You should write a SQL statement to investigate all the tables in your
database.
and execute that with a command.executeQuery

And than make a select for every table.

There is not a SQL statement.
Select * from * as far as I know.
However my knowledge of SQL is fair, because I hate it.

Than I think you can even do when you set the names in a table
\\\
For i as integer = 0 to myTalblenameArray.length - 1
dataadatper.fill(dataset, myTablenameArray(i))
next
///
I hope this helps?

Cor

Similar Threads

1. Newbie question: Fill dataset will ALL tables from database - Asp.Net

2. Newbie question on filling typed dataset

Hi all,

First post here, and I'm a total noob at all this .NET stuff so bear 
with me :)

Got a query on filling a typed dataset.  If I create a typed dataset 
containing two tables in a master/detail relationship, such as Orders 
and OrderDetails, how do I go about filling this with a data adapter?

I'm not quite sure whether I have to fill each table in the dataset 
separately using two different data adapters, or whether it can all be 
done in one step via a single data adapter, and if so how?

Any help appreciated, many thanks.
-- 
Toby

3. Newbie Question: fill a dataset with results from web service call - Asp.Net Web Service

4. Howto fill a sql mobile database with a dataset filled with readxml

Hi All,

On the desktop I have multiple SQL server 2005 Express edition tables.
On the server, I use a dataset in combination with writexml to generate an 
xml file (dnldata.xml) from a couple of queries 
(DnlData.WriteXml("c:\test\Dnldata.xml"))
After it, I transfer dnldata.xml to the pda and use ReadXml to fill a 
DataSet.

What is the easiest (best) way to read the dnldata.xml into an SQL MOBILE 
2005 database (*.sdf)?
The old fashioned way was using csv files with records, mannually inserted 
into the pda database. I want to change that.

The structure of the SQL server 2005 Express edition tables and the SQL 
MOBILE 2005 tables on the pda
are exactly the same.
Do I have to parse all the records manually?
Or Can I use Dataset.readxml in combination with other data-objects?

probably this is not the right way.

Any help would be greatly appreciated.
best regards

I tried the following which not seems to work:


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles Button1.Click
        Dim DnlData As New System.Data.DataSet

        Using MySqlConnection As New 
System.Data.SqlServerCe.SqlCeConnection( _
            "Data source=" & "\Storage Card\Ztest\Mydb.sdf" & "; " & _
            "SSCE:Database Password=xxx; " & _
            "SSCE:Encrypt Database=True")

            Using MySqlCeDataAdapter As New 
System.Data.SqlServerCe.SqlCeDataAdapter("Select * from klant", 
MySqlConnection)
                Dim MySqlCeCommandBuilder As New 
System.Data.SqlServerCe.SqlCeCommandBuilder(MySqlCeDataAdapter)

                MySqlConnection.Open()
                DnlData.ReadXml("\Storage Card\Ztest\Dnldata.xml")

  MySqlCeDataAdapter.InsertCommand = MySqlCeCommandBuilder.GetInsertCommand
                MySqlCeDataAdapter.UpdateCommand = 
MySqlCeCommandBuilder.GetUpdateCommand
                MySqlCeDataAdapter.DeleteCommand = 
MySqlCeCommandBuilder.GetDeleteCommand

                ' MySqlCeDataAdapter.Update(DnlData)
  '


            End Using
        End Using
    End Sub


5. Row removed from a dataset table is not removed from a database table during update - ADO.Net

6. Fill Database Table with Sample data

I want to load some sample data for my nunit unit tests in the database. 
And I want to do this by taking the data from a file, preferably an xml file that is generated by the command "SELECT * FROM SomeTbl FOR XML AUTO". I want to load this back to the table without much effort. 
Is there a simple way of doing this?
Is there any adapter that lets me fill the database table using the xml file?

Thanks



7. Fill related tables in dataset with one query? - ADO.Net

8. fill a multi-table dataset for Oracle

When I call a dataAdapter's Fill method to load a multi-
table dataset from SQL Server, I can use a sql string 
something like "SELECT * FROM table1;SELECT * FROM table2" 
as the command text and it will give me a dataset with two 
tables. But my problem is that I have to support both SQL 
Server and Oracle. Oracle doesn't seem to support this. 
How do I do this in oracle?

The ideal solution for me would be one logic that supports 
both data sources. Is it possible to 1) use separate 
select statements to load a dataset that contain multiple 
tables? How? or, 2) Does Oracle also support the same 
combined sql select statements but with some different 
syntax that's unknown to me?

Thanks