Primary Key not returning in dataset - DOTNET
This is a discussion on Primary Key not returning in dataset - DOTNET ; I am populating a dataset with a simple SQL statement, I need to have the
primary keys returned with the data. I am using the following code to get
the data and the keys:
dataAdapter.MissingSchemaAction = missingSchemaAction.AddWithKey
dataAdapter.Fill(ds)
When I ...
-
Primary Key not returning in dataset
I am populating a dataset with a simple SQL statement, I need to have the
primary keys returned with the data. I am using the following code to get
the data and the keys:
dataAdapter.MissingSchemaAction = missingSchemaAction.AddWithKey
dataAdapter.Fill(ds)
When I use the following SQL statement, I do not get any primary keys
returned in the dataset:
SELECT table1.* FROM table1 INNER JOIN table2 ON table1.ID = table2.ID
However, if I use the following statement, I get keys returned.
SELECT * FROM table1 INNER JOIN table2 ON table1.ID = table2.ID
If I do this, I get the keys for both tables returned as a primary key.
Why, in my first SQL Statement do I not get any primary keys, and is there a
way to work around that?
Thanks,
Jason Lander
-
Re: Primary Key not returning in dataset
Yes: populate the first table, then the second. ADO.NET was not designed to
work with flattened queries.
S. L.
"JRLander" <JRLander@discussions.microsoft.com> wrote in message
news
876FE70-37C8-4401-8E7C-DA43272D51CB@microsoft.com...
>I am populating a dataset with a simple SQL statement, I need to have the
> primary keys returned with the data. I am using the following code to get
> the data and the keys:
>
> dataAdapter.MissingSchemaAction = missingSchemaAction.AddWithKey
> dataAdapter.Fill(ds)
>
> When I use the following SQL statement, I do not get any primary keys
> returned in the dataset:
>
> SELECT table1.* FROM table1 INNER JOIN table2 ON table1.ID = table2.ID
>
> However, if I use the following statement, I get keys returned.
>
> SELECT * FROM table1 INNER JOIN table2 ON table1.ID = table2.ID
>
> If I do this, I get the keys for both tables returned as a primary key.
> Why, in my first SQL Statement do I not get any primary keys, and is there
> a
> way to work around that?
>
> Thanks,
>
> Jason Lander
Similar Threads
-
By Application Development in forum CSharp
Replies: 1
Last Post: 11-16-2007, 11:50 AM
-
By Application Development in forum DOTNET
Replies: 0
Last Post: 08-16-2007, 09:39 AM
-
By Application Development in forum DOTNET
Replies: 15
Last Post: 02-26-2007, 12:37 PM
-
By Application Development in forum DOTNET
Replies: 2
Last Post: 11-20-2006, 06:02 AM
-
By Application Development in forum DOTNET
Replies: 1
Last Post: 10-30-2003, 09:39 PM