SqlCommand cmdDesign = new SqlCommand(); cmdDesign.Connection = Cn; cmdDesign.CommandType = CommandType.StoredProcedure; cmdDesign.CommandText = "EIS_spGetEmployeeCategory"; cmdDesign.Parameters.Add("@User_Id", SqlDbType.Int).Value = intUserId; SqlDataAdapter daDesign = new SqlDataAdapter(); daDesign.SelectCommand = cmdDesign; daDesign.Fill(ds, "EmpCat"); SqlCommand cmdEdu = new SqlCommand(); cmdEdu.Connection = Cn; cmdEdu.CommandType = CommandType.StoredProcedure; cmdEdu.CommandText = "EIS_spGetEmployeeBasicQualificationList"; cmdEdu.Parameters.Add("@Id", SqlDbType.Int).Value = intUserId; SqlDataAdapter daEdu = new SqlDataAdapter(); daEdu.SelectCommand = cmdEdu; daEdu.Fill(ds, "EmpEdu"); string fileName = Server.MapPath("."); fileName = fileName + "\\Templates\\Resume_Template2.xml"; XmlDocument xmlTemplateDoc = new XmlDocument(); xmlTemplateDoc.Load(fileName); CExWordMLFiller wfiller = new CExWordMLFiller(ds, xmlTemplateDoc.OuterXml); wfiller.Transform(); string copyFileName = Path.GetTempFileName() + ".xml"; wfiller.WordMLDocument.Save(copyFileName); Response.Clear(); Response.ContentType = "application/msword"; Response.Charset = ""; Response.AddHeader("Content-disposition", "inline: filename=" + copyFileName + ""); Response.WriteFile(copyFileName); Response.Flush(); Response.Close(); This was the code i used earlier.But i want to split this code so that each dataset in separate functions in class.There comes the trouble. CExWordMLFiller wfiller = new CExWordMLFiller(ds, xmlTemplateDoc.OuterXml); This 'ds' comprises all datasets.. This is the new code..: public DataSet GetEmployeeCategory (int userId) { DataView dvTemplate = null; int templateId=0; string SP = DBObjectName.spGetEmployeeCategory; Hashtable htParameters = new Hashtable(); htParameters.Add("@User_Id",MISUtility.CheckNull(templateId)); DataSet EmpCat = new DataSet(); try { OpenConnection(); dvTemplate = Connection.ExecuteProcedure(SP,htParameters); DataTable dtTmp = dvTemplate.Table; EmpCat.Tables.Add(dtTmp); } catch(Exception e) { throw new MISException("AdvancedReport.GetEmployeeCategory() failed",e); } finally {