CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2003
    Location
    Traverse City, MI
    Posts
    24

    Question Using a DataSet object as a return parameter

    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

  2. #2
    Join Date
    Mar 2003
    Location
    Traverse City, MI
    Posts
    24
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured