Click here to Skip to main content
15,890,506 members
Home / Discussions / Database
   

Database

 
GeneralRe: Question about from syntax Pin
Esmo200028-Mar-05 7:41
Esmo200028-Mar-05 7:41 
GeneralDatasets/Updating Pin
Nuhn28-Mar-05 3:16
Nuhn28-Mar-05 3:16 
GeneralRe: Datasets/Updating Pin
Suman Singh29-Mar-05 11:04
professionalSuman Singh29-Mar-05 11:04 
GeneralRe: Datasets/Updating Pin
Nuhn7-Apr-05 4:56
Nuhn7-Apr-05 4:56 
Questionhow to get name of all tables in msaccess database Pin
sumit2127-Mar-05 7:07
sumit2127-Mar-05 7:07 
AnswerRe: how to get name of all tables in msaccess database Pin
rwestgraham28-Mar-05 18:25
rwestgraham28-Mar-05 18:25 
GeneralDataRelation question Pin
IlanTal26-Mar-05 21:36
IlanTal26-Mar-05 21:36 
GeneralRe: DataRelation question Pin
Scott Serl28-Mar-05 10:06
Scott Serl28-Mar-05 10:06 
IlanTal wrote:
According to what I've read, it is desirable to have DataSet objects where each DataSet object addresses a single table.

No, you would only have 1 dataset, but it would have multiple DataTables in it. You fill the tables with data using one or more data adapters. Then you would add a DataRelation to your DataSet, relating the 2 tables.

So, if you get the patient records with:
SELECT Patient.* FROM Patient WHERE name LIKE 'abc'

You can use a join to fill the Study table, but do not retrieve any fields from the Patient table:
SELECT DISTINCT Study.*
FROM Study
INNER JOIN Patient ON Study.PatientID = Patient.PatientID
WHERE Patient.name LIKE 'abc'

Then add a DataRelation to your dataset:
MyDataSet.Relations.Add("PatientStudies",MyDataSet.Tables("Patients").Columns("PatientID"), MyDataSet.Tables("Studies").Columns("PatientID"))

You could fill the dataset with 2 queries, or you could use a stored procedure to run both queries in a single call to the server (return multiple result sets if your database supports it).

IlanTal wrote:
Suppose I want to query on the basis of date. Then I efficiently query the studies table, but how do I efficiently query the patients table?

SELECT DISTINCT Patient.*
FROM Patient
INNER JOIN Study ON Patient.PatientID = Study.PatientID
WHERE Study.Date BETWEEN @FirstDate AND @SecondDate
GeneralRe: DataRelation question Pin
IlanTal28-Mar-05 18:38
IlanTal28-Mar-05 18:38 
GeneralRe: DataRelation question Pin
Scott Serl29-Mar-05 6:44
Scott Serl29-Mar-05 6:44 
GeneralRe: DataRelation question Pin
IlanTal29-Mar-05 7:10
IlanTal29-Mar-05 7:10 
GeneralQuestion about SELECT Pin
_J_26-Mar-05 5:57
_J_26-Mar-05 5:57 
GeneralRe: Question about SELECT Pin
turbochimp26-Mar-05 11:35
turbochimp26-Mar-05 11:35 
GeneralRe: Question about SELECT Pin
Colin Angus Mackay29-Mar-05 1:03
Colin Angus Mackay29-Mar-05 1:03 
GeneralRe: Question about SELECT Pin
_J_29-Mar-05 1:41
_J_29-Mar-05 1:41 
GeneralRe: Question about SELECT Pin
Colin Angus Mackay29-Mar-05 1:48
Colin Angus Mackay29-Mar-05 1:48 
GeneralRe: Question about SELECT Pin
_J_29-Mar-05 1:51
_J_29-Mar-05 1:51 
GeneralRe: Question about SELECT Pin
Colin Angus Mackay29-Mar-05 1:56
Colin Angus Mackay29-Mar-05 1:56 
GeneralRe: Question about SELECT Pin
_J_29-Mar-05 2:02
_J_29-Mar-05 2:02 
GeneralSaving file in SQL Server Pin
dabuskol25-Mar-05 19:48
dabuskol25-Mar-05 19:48 
GeneralRe: Saving file in SQL Server Pin
turbochimp25-Mar-05 20:12
turbochimp25-Mar-05 20:12 
GeneralSELECT TOP Pin
vuthaianh25-Mar-05 12:10
vuthaianh25-Mar-05 12:10 
GeneralRe: SELECT TOP Pin
turbochimp25-Mar-05 17:49
turbochimp25-Mar-05 17:49 
GeneralSimplify a T-SQL Pin
WDI25-Mar-05 7:41
WDI25-Mar-05 7:41 
GeneralRe: Simplify a T-SQL Pin
Michael Potter25-Mar-05 8:24
Michael Potter25-Mar-05 8:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.