Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FillDataSet
Message
From
15/05/2009 21:51:49
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Miscellaneous
Thread ID:
01400227
Message ID:
01400234
Views:
45
You don't need to do it that way as the business objects know how to get a DataSet if that is what you want. Maybe something like this would get you there if you want to return a DataSet. Also, there are lots of overloads and some of those allow you to specify the CommandType. If in your business object you have the Default CommandType set to Stored Procedure, then you should specify here when you are doing something different. Your error is most likely because you are passing in a SQL Select statement when your default command type is set to Stored Procedure. Just use an overload to specify the CommandType or change your default setting to what you need it to be.

Also, you can set the Default CommandType to one thing in the aBusinessObject, but if you have a business object specific you always use CommandType.Text, then change it in that business object. All that saves is not haveing to specify it at the Get methods with the overloads.

In the business object method if you want to return a DataSet like your are specifing, then you could just use the GetDataSet method call like below or one of the overloads.
public DataSet GetCustomersByName(string cName)
{
    return this.GetDataSet("SELECT * FROM Customer", CommandType.Text);
}
Also sometimes if I want a DataSet, I still just call a Get method to retrieve the entities so I can use the method in other places where I want entities. But if I need a DataSet in one paticular area of my application, I just get the dataset after the entities are retieved within the UI since the DataSet is sitting on the business object already at that point.

In the business object method call GetEntityList and return that but in the UI you can then retrieve the DataSet from that.
Business Object method
public mmBindingList<CustomerEntity> GetCustomersbyName(string cName)
{
  return this.GetEntityList("SELECT * FROM Customers", CommandType.Text);
}
Then in the Form you can call this and still get the DataSet
oCustomer.GetCustomersByName(string cName);
// Now you can have the DataSet if you want to bind it something that way.
DataSet dsCustomers = this.oCustomer.DataSet;
Anyway, just some ideas.
Tim


>Can you use FillDataSet() if your business objects were setup to use stored procedures rather than SQL - SELECT?
>
>
>I've added this method to my business object:
>       public DataSet getCustomersByName(string cName)
>        {
>            this.FillDataSet(this.GetCurrentDataSet(),
>                    "SELECT txtParentCompName, txtMailAdd1, txtMailCity, txtMailState, txtMailZip, txtFacilityName, txtMemberType FROM Members WHERE txtName = '" + cName + "'", "crsCustomers");
>            return this.GetCurrentDataSet();
>        }
>
>
>but I get an error stating
Could not find stored procedure ''. "
in the FillDataSet() call.
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform