Reputation: 1
This may seem simple, but I'm having difficulty figuring out how to fill my dataset when my query includes more than one table.
For example, if I had a query that was "SELECT USER_ID, USER_NAME, CREDENTIALS FROM USERS, CREDENTIALS WHERE USER_ID = CRED_ID" and then try to use the DataAdapter.Fill method it throws and error saying it's not a single group function.
My DataAdapter is = da
My DataSet is = ds
What I'm trying is:
da.Fill(ds, "USERS;CREDENTIALS");
or
da.Fill(ds, "USERS, CREDENTIALS");
How would I go about doing this correctly? I just need to run a query that selects from 2 tables based on a matching ID, but I'd like it in a single Dataset so I can go through the results 1 row & column at a time.
Any help is GREATLY appreciated!
Upvotes: 0
Views: 1868
Reputation: 1
Problem solved. I had a MAX function being performed in my query and I did not have all SELECT fields listed in the GROUP BY clause.
Added those fields and got it working.
Thanks to all!
Upvotes: 0
Reputation: 442
I'm confused. The result you are getting back is a single "table". You are doing a join between two tables, sure, but you are not actually returning two tables. Is there something I am missing?
Upvotes: 1