S
Shawn McNiven
Hi,
I'm having a problem that I'm hoping someone can help me with. To start, I
have to mention a couple of limitations I'm working with:
1) My organization uses an in-house framework to handle database
connections, calling stored procs etc.. To call a stored proc, I use
something called a SqlPassThru.ExecuteStoredProcedure() which returns a
dataset.
2) All calls to the database are done through stored procs
3) I have no control over the database I'm working with. That means I can
only use the existing stored procs. I can't write any new procs or modify
the existing procs
I'm trying to populate a datagrid with a list of cities. I want to display
the city name, country, time difference and hardship level. I get that
information by using the following:
dgCities.DataSource =
SqlPassThru.ExecuteStoredProcedure("Enterprise..GetCity")
That returns City ID, CityName, CityNameFrench, CountryID, TimeDifference
and HardshipLevel.
The problem is I want to display the Country Name, not the country id.
There is another stored proc called "GetCountry" which gives me CountryId,
Country Name etc...
I tried creating 2 new datasets for the cities and countries and then adding
the countries dataset to the cities dataset. But that didn't work.
I tried to merge the two datasets together but that didn't work.
I then tried to return 2 datatables using another method in the SqlPassThru
object which returns datatables (SqlPassThru.ExecuteDataTable()). I tried
to add both datatables to the empty dataset and create a relationship
between them, but got an error message when adding the first datatable
saying that it already belonged to a dataset (I can't remember the error off
hand right now).
A colleague mentioned something about a calculated field in the dataset, but
I haven't looked that up yet.
Anyone have any suggestions on how to approach this? Many thanks in
advance.
Shawn McNiven
I'm having a problem that I'm hoping someone can help me with. To start, I
have to mention a couple of limitations I'm working with:
1) My organization uses an in-house framework to handle database
connections, calling stored procs etc.. To call a stored proc, I use
something called a SqlPassThru.ExecuteStoredProcedure() which returns a
dataset.
2) All calls to the database are done through stored procs
3) I have no control over the database I'm working with. That means I can
only use the existing stored procs. I can't write any new procs or modify
the existing procs
I'm trying to populate a datagrid with a list of cities. I want to display
the city name, country, time difference and hardship level. I get that
information by using the following:
dgCities.DataSource =
SqlPassThru.ExecuteStoredProcedure("Enterprise..GetCity")
That returns City ID, CityName, CityNameFrench, CountryID, TimeDifference
and HardshipLevel.
The problem is I want to display the Country Name, not the country id.
There is another stored proc called "GetCountry" which gives me CountryId,
Country Name etc...
I tried creating 2 new datasets for the cities and countries and then adding
the countries dataset to the cities dataset. But that didn't work.
I tried to merge the two datasets together but that didn't work.
I then tried to return 2 datatables using another method in the SqlPassThru
object which returns datatables (SqlPassThru.ExecuteDataTable()). I tried
to add both datatables to the empty dataset and create a relationship
between them, but got an error message when adding the first datatable
saying that it already belonged to a dataset (I can't remember the error off
hand right now).
A colleague mentioned something about a calculated field in the dataset, but
I haven't looked that up yet.
Anyone have any suggestions on how to approach this? Many thanks in
advance.
Shawn McNiven