Click to See Complete Forum and Search --> : Using a DataSet object as a return parameter


theday_99
March 19th, 2003, 01:57 PM
Hey all,

Im new to c# so bear with me. I searched the forum and couldn't find the answer to this question, so any help would be appreciated. I have a little function I use called MakeDataSet, in which I return a dataset from a passed in sql statement. I set a DataSet equal to the method call from where I call the function,
oDataSet = MakeDataSet(sSQL); for example. Here is my problem, when I go to close oDataSet, it tells me that I already have a DataSet open on the current connection and I must close it first. I assume its talking about the DataSet in the MakeDataSet function. But I obviously cant close that before I return the DataSet or Ill just end up with a closed DataSet before I begin my logic. What am I doing wrong here?

Thanks so much,
Ryan

theday_99
March 19th, 2003, 02:14 PM
It seems like it was telling me that I had to close the DataReader before I executed a ExecuteNonQuery method with the command object. Sorry about that, Im an idiot. LOL

Thanks anyways,
Ryan