Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 22, 2007 01:45 AM by Kevin Yu - MSFT
Feb 20, 2007 02:35 PM|LINK
Hello, I'm experiencing a conflict between my DataSet.xsd and and a Sql Helper business object.
In my business object... whenever I attempt to create a new dataset (ie, DataSet ds = new DataSet()), the dataSet is being loaded with the DataSet.xsd info and not my custom object info. Is there a way I can get around this--I've bolded the problem below?
Any help would be greatly appreciated! :)
Here is my custom object code:
public static DataSet ExecuteDataset(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter commandParameters)
//create a command and prepare it for execution
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, commandParameters);
//create the DataAdapter & DataSet
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet(); // ** ds.Tables.TableName will be "MemberInfo" which is being pulled from DataSet.xsd) I need this DataSet to reference the custom info I am passing in, not the DataSet.xsd.
//fill the DataSet using default values for DataTable names, etc.
// detach the SqlParameters from the command object, so they can be used again.
//return the dataset
Feb 22, 2007 01:45 AM|LINK
From the code, I can see that you're using a SqlHelper class to get the command execute and return a DataSet.
Based on my experience, the SqlHelper class provided in the Data Access Application Block is only suitable to be used for an untyped DataSet. If you have your own Business Logic Layer and need to use a typed DataSet you defined, I suggest you customize your
own Data Access Layer.
You can create and fill a typed DataSet instance and return it to BLL.