public DataSet ConvertDataReaderToDataSet(System.Data.Odbc.OdbcDataReader reader) { DataSet dataSet = new DataSet(); do { // Create data table in runtime DataTable schemaTable = reader.GetSchemaTable(); DataTable dataTable = new DataTable(); if (schemaTable != null) { DataColumn column1 = new DataColumn("id", typeof(int)); dataTable.Columns.Add(column1); DataColumn column2 = new DataColumn("dato", typeof(DateTime)); dataTable.Columns.Add(column2); DataColumn column3 = new DataColumn("editor", typeof(string)); dataTable.Columns.Add(column3); DataColumn column4 = new DataColumn("origin", typeof(int)); dataTable.Columns.Add(column4); DataColumn column5 = new DataColumn("medarbejderid", typeof(string)); dataTable.Columns.Add(column5); DataColumn column6 = new DataColumn("jobid", typeof(int)); dataTable.Columns.Add(column6); DataColumn column7 = new DataColumn("aktnavn", typeof(string)); dataTable.Columns.Add(column7); DataColumn column8 = new DataColumn("timer", typeof(double)); dataTable.Columns.Add(column8); DataColumn column9 = new DataColumn("tdato", typeof(DateTime)); dataTable.Columns.Add(column9); DataColumn column10 = new DataColumn("lto", typeof(string)); dataTable.Columns.Add(column10); DataColumn column11 = new DataColumn("timerkom", typeof(string)); dataTable.Columns.Add(column11); dataSet.Tables.Add(dataTable); // Fill the data table from reader data while (reader.Read()) { DataRow dataRow = dataTable.NewRow(); dataRow["id"] = reader.GetValue(0); dataRow["dato"] = reader.GetValue(1); dataRow["editor"] = reader.GetValue(2); dataRow["origin"] = reader.GetValue(3); dataRow["medarbejderid"] = reader.GetValue(4); dataRow["jobid"] = reader.GetValue(5); dataRow["aktnavn"] = reader.GetValue(6); dataRow["timer"] = reader.GetValue(7); dataRow["tdato"] = reader.GetValue(8); dataRow["lto"] = reader.GetValue(9); //10 Overfort omited here dataRow["timerkom"] = reader.GetValue(10); //11 dataTable.Rows.Add(dataRow); } } else { // No records were returned DataColumn column = new DataColumn("RowsAffected"); dataTable.Columns.Add(column); dataSet.Tables.Add(dataTable); DataRow dataRow = dataTable.NewRow(); dataRow[0] = reader.RecordsAffected; dataTable.Rows.Add(dataRow); } }while (reader.NextResult()); return(dataSet); }