I am having problems with setting up a dataset and adapters.
I want to display data from 2 tables "Person" and "PersonContact"
for a particular person selected on a windows form.
By using parameterized query, how do I set adapters and dataset to accomplish this?
Currently, I have followings:
2 Tables "Person" and "PersonContact" that have relationship in a dataset "dsPersonFolder"
DataAdapter
"daPerson" .... "SELECT PersonID, FName FROM Person WHERE PersonID=?"
"daPersonContact" ...."SELECT PersonID, Street, City FROM PersonContact WHERE PersonID=?"
in VB.Net code,
Dim ID as Interger
...get a value of ID...
daPerson.SelectCommand.Parameters(0).Value = ID
daPersonContact.SelectedCommand.Parameters(0).Value = ID
daPerson.fill(dsPersonFolder.Person)
daPersonContact.fill(dsPersonFolder.PersonContact)
Does this make sense or I'm doing all wrong?
When do I use getchildrows method to get a realted data from its parent?
My way doesn't seem there is a relationship between tables when I call 2 datarows separately.
Do I even need to relate two tabels by saying
"SELECT P.PersonID, P.FName, PC.Street, PC.City
FROM Person P, PersonContact PC
WHERE P.PersonID=PC.PerosnID"
As you can tell, I am totally confused with dataset in ADO.net.
Please help me!!!
By the way, I am using MS Access for my database.
I want to display data from 2 tables "Person" and "PersonContact"
for a particular person selected on a windows form.
By using parameterized query, how do I set adapters and dataset to accomplish this?
Currently, I have followings:
2 Tables "Person" and "PersonContact" that have relationship in a dataset "dsPersonFolder"
DataAdapter
"daPerson" .... "SELECT PersonID, FName FROM Person WHERE PersonID=?"
"daPersonContact" ...."SELECT PersonID, Street, City FROM PersonContact WHERE PersonID=?"
in VB.Net code,
Dim ID as Interger
...get a value of ID...
daPerson.SelectCommand.Parameters(0).Value = ID
daPersonContact.SelectedCommand.Parameters(0).Value = ID
daPerson.fill(dsPersonFolder.Person)
daPersonContact.fill(dsPersonFolder.PersonContact)
Does this make sense or I'm doing all wrong?
When do I use getchildrows method to get a realted data from its parent?
My way doesn't seem there is a relationship between tables when I call 2 datarows separately.
Do I even need to relate two tabels by saying
"SELECT P.PersonID, P.FName, PC.Street, PC.City
FROM Person P, PersonContact PC
WHERE P.PersonID=PC.PerosnID"
As you can tell, I am totally confused with dataset in ADO.net.
Please help me!!!
By the way, I am using MS Access for my database.