How to execute a Inner Join between Tables on a DATASET 
Author Message
 How to execute a Inner Join between Tables on a DATASET

Hi All,

Somebody knows how to run a Query with inner joins between tables of a
disconnected Dataset?

Usually after creating a Dataset with relations and Keys from the Data
Adapter witch connects to the Database we close the DataAdapter and work
only with the Dataset, so we need to work with the inner join between tables
of a Dataset.

The Sql command need a connection to the database, what is the best way to
execute Queries to Tables in a Dataset without requiring the connection to
the Database?

Thanks in Advance,
    Joviano Silva



Sat, 30 Oct 2004 19:21:21 GMT  
 How to execute a Inner Join between Tables on a DATASET
Hi Joviano,

Running queries on tables of a disconnected DataSet are not supported by
ADO.NET. You would have to iterate through the existing tables and add data
to your new table.

If you plan to run a lot of queries on tables of a disconnected DataSet(s),
you might want to consider storing data on the client side in a small
database such as access or fox which provide OleDb access.

hth,
Kamal
--------------------------------------------------
Kamal Patel
http://www.KamalPatel.net
--------------------------------------------------


Quote:
> Hi All,

> Somebody knows how to run a Query with inner joins between tables of a
> disconnected Dataset?

> Usually after creating a Dataset with relations and Keys from the Data
> Adapter witch connects to the Database we close the DataAdapter and work
> only with the Dataset, so we need to work with the inner join between
tables
> of a Dataset.

> The Sql command need a connection to the database, what is the best way to
> execute Queries to Tables in a Dataset without requiring the connection to
> the Database?

> Thanks in Advance,
>     Joviano Silva



Sat, 30 Oct 2004 20:42:17 GMT  
 How to execute a Inner Join between Tables on a DATASET
The following is an example of a query on a dataset

 Dim strExpr As String = "ID = '" & sID & "'"
        Dim Drs() As DataRow = ds.Tables("MyTable").Select(strExpr)

I usually fill my datasets with stored procedures that have the joins
in them so im not sure how much this helps or the exact syntax for
adding a join to strExpr.

Good Luck,
        Sean

On Tue, 14 May 2002 12:21:21 +0100, "Joviano Silva"

Quote:

>Hi All,

>Somebody knows how to run a Query with inner joins between tables of a
>disconnected Dataset?

>Usually after creating a Dataset with relations and Keys from the Data
>Adapter witch connects to the Database we close the DataAdapter and work
>only with the Dataset, so we need to work with the inner join between tables
>of a Dataset.

>The Sql command need a connection to the database, what is the best way to
>execute Queries to Tables in a Dataset without requiring the connection to
>the Database?

>Thanks in Advance,
>    Joviano Silva



Sat, 30 Oct 2004 21:23:55 GMT  
 How to execute a Inner Join between Tables on a DATASET
Thanks Kamal,

I had believed that inner joins in dataset would be possible because it
makes sense,  the dataset have primary keys, foreign keys and relations and
it only to use existing features.

To solve my problem i use the iteration to the datarow collection witch is
more slowly and with more code, to simply insert a dataset table in an
access database and test if the new row already exists in the table of  the
target database.

Is there a simply Way?

The Code goes Here:
Dim Erow As DataRow

Dim e1Row As DataRow

Dim Etable As DataTable

Dim E1table As DataTable

AccAdDocDestino.Fill(dsAccess, "DocDestino")

Dim sqlCmd2 As OleDbCommand

Dim dcd As String

Dim dcDes As String

Dim TrueTable As Boolean

For Each e1Row In ds.Tables("DocDestino").Rows

        TrueTable = False

        For Each Erow In dsAccess.Tables("DocDestino").Rows

                If e1Row("DocDestino") = Erow("DocDestino") Then

                        MessageBox.Show("DBAccess:" &
Erow("DocDestino").ToString & vbTab & vbTab)

                Else

                        TrueTable = True

                        dcd = Erow("DocDestino").Column("Docdestino")

                        dcdes = Erow("DocDestino").Column("Docdestino")

                End If

        Next

        If TrueTable = True Then

        sqlCmd2 = New OleDbCommand("insert into DocDestino
(Docdestino,DocDestDescr) Values ('" & dcd & "','" & dcDes & "')",
AccessCon)

        sqlCmd2.ExecuteNonQuery()

End If

Next

Thanks in Advance,
    Joviano Silva



Quote:
> Hi Joviano,

> Running queries on tables of a disconnected DataSet are not supported by
> ADO.NET. You would have to iterate through the existing tables and add
data
> to your new table.

> If you plan to run a lot of queries on tables of a disconnected
DataSet(s),
> you might want to consider storing data on the client side in a small
> database such as access or fox which provide OleDb access.

> hth,
> Kamal
> --------------------------------------------------
> Kamal Patel
> http://www.KamalPatel.net
> --------------------------------------------------



> > Hi All,

> > Somebody knows how to run a Query with inner joins between tables of a
> > disconnected Dataset?

> > Usually after creating a Dataset with relations and Keys from the Data
> > Adapter witch connects to the Database we close the DataAdapter and work
> > only with the Dataset, so we need to work with the inner join between
> tables
> > of a Dataset.

> > The Sql command need a connection to the database, what is the best way
to
> > execute Queries to Tables in a Dataset without requiring the connection
to
> > the Database?

> > Thanks in Advance,
> >     Joviano Silva



Sat, 30 Oct 2004 23:02:14 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. SELECT . INNER JOIN--INNER JOIN

2. !how VB update Table A INNER JOIN Table B, Set A.co=B.ID

3. how VB update Table A INNER JOIN Table B, Set A.co=B.ID

4. how VB update Table A INNER JOIN Table B, Set A.co=B.ID

5. how VB update Table A INNER JOIN Table B, Set A.co=B.ID

6. how VB update Table A INNER JOIN Table B, Set A.co=B.ID

7. how VB update Table A INNER JOIN Table B, Set A.co=B.ID

8. how VB update Table A INNER JOIN Table B, Set A.co=B.ID

9. !how VB update Table A INNER JOIN Table B, Set A.co=B.ID

10. !how VB update Table A INNER JOIN Table B, Set A.co=B.ID

11. how VB update Table A INNER JOIN Table B, Set A.co=B.ID

12. INNER JOIN 2 TABLES

 

 
Powered by phpBB® Forum Software