Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Populating Dataset with Table-Valued Function
Message
 
À
04/08/2010 10:15:32
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01475027
Message ID:
01475205
Vues:
29
I definitely bristled at sticking SQL code into my app like that, even if it's just a call to a function that's stored in the database. I reckon I'll have to set aside purity for pragmatism.

Thanks,

Eric


>Hi Eric,
>
>I see you got something that works, and it makes sense. The only other suggestion I have is by using SQL like this you have removed your ability to be database independant. You could also call your getCommitteMembers() method from within a stored procedure I believe. That would get you back to still using stored procedures and keeping your SQL specific code out. Just something to think about.
>Tim
>
>>Ah, thanks Rob. It wasn't quite there but put me on the right track to make this work:
>>
>>
>>  public DataSet getCommitteeMembers(int iComId)
>>        {
>>            SqlCommand cCmd = new SqlCommand(String.Format("SELECT * FROM CommitteeMembers({0})",iComId));
>>            return this.GetDataSet(cCmd, "crsCommitteMembers");
>>        }
>>
>>
>>Works like a charm.
>>
>>Thanks!
>>
>>Eric
>>
>>>Try this:
>>>
>>>
>>>public DataSet getCommitteesById(int iComId)
>>>{
>>>     return this.GetDataSet("SELECT * FROM getCommitteeMembers(@ComId)", this.CreateParameter("@ComId", iComId));
>>>}
>>>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform