Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
View into Dataset
Message
 
À
06/11/2009 12:54:00
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:
01433587
Message ID:
01433638
Vues:
28
>>Eric,
>>
>>You can use methods on the busines object that returns a DataSet or you can use the normal methods and then do this.
>>
>>// Call the business object method just like you normally would for entities or entity lists.
>>this.oLookups.GetLookupsByType("CustomerTypes");
>>// Then retrieve the DataSet from the dataset property of the business object.
>>DataSet dsLookups = this.oLookups.DataSet;
>>
>>
>>You can also create methods on your business object that return a dataset to start with.
>>Hope that helps.
>>Tim
>>
>>>What would be the easiest way to get a SQL Server view down into a dataset? I don't really need a business object or anything else for this.
>>>
>>>Thanks,
>>>
>>>Eric
>
>I just re-read your question and see I missed the point. I assumed since it was in the mm area, you were asking this about biz objs.
>
>I still think if you are using mm the easiest way is to use a business object to get the data. You can either create a business object that matches the view or use an existing one that is appropriate but since it comes from a view and not a stored procedure you will most likely need to use SQL statement in your method and definately return it into a DataBase.
>
>
>// In your business object
>public DataSet GetLookupByType(string lookupType)
>{
>     // If you use DataSet as your return type and call a method to retrieve a DataSet it should be the easiest.
>     return this.GetDataSet("SELECT * FROM MyView....");
>}
>
>
>This way you do not have to worry about the connections and such as it is all taken care of for you.
>Tim

There is one other option. When I just need a dataset for a report, I have a generic business object which has methods that build datasets from a variety of SQL tables and views using stored procedures. You will want to use a table name with them. You need to be careful to check to see if the table name exists. If so, you will need to remove it before creating another table with that name.
Linda
Linda Harmes
HiBit Technologies, Inc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform