Changeset 7625 for branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.DbExplorer.Interfaces
- Timestamp:
- 03/15/12 17:51:45 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.DbExplorer.Interfaces/DbExplorerBase.cs
r7267 r7625 101 101 filterColumns.Add(col); 102 102 } 103 cmdText += "count(*) from " + EscapeSqlString(table.OwnerName )+ "." + EscapeSqlString(table.TableName);103 cmdText += "count(*) from " + EscapeSqlString(table.OwnerName) + "." + EscapeSqlString(table.TableName); 104 104 cmd.CommandText = cmdText; 105 105 … … 222 222 //fill columns with values 223 223 for (int i = 0; i < reader.FieldCount; i++) { 224 if (reader.IsDBNull(i)) 224 if (reader.IsDBNull(i)) { 225 225 columnGroup.Columns.ElementAt(i).AddValue(null); 226 else if (columnGroup.Columns.ElementAt(i).DataType == typeof(double?)) 227 columnGroup.Columns.ElementAt(i).AddValue(Convert.ToDouble(reader.GetValue(i))); 228 else if (columnGroup.Columns.ElementAt(i).DataType == typeof(DateTime?)) 229 columnGroup.Columns.ElementAt(i).AddValue(reader.GetDateTime(i)); 230 else 231 columnGroup.Columns.ElementAt(i).AddValue(reader.GetValue(i).ToString()); 226 } else if (columnGroup.Columns.ElementAt(i).DataType == typeof(double?)) { 227 try { columnGroup.Columns.ElementAt(i).AddValue(Convert.ToDouble(reader.GetValue(i))); } 228 catch (DbException) { columnGroup.Columns.ElementAt(i).AddValue(null); } 229 } else if (columnGroup.Columns.ElementAt(i).DataType == typeof(DateTime?)) { 230 try { columnGroup.Columns.ElementAt(i).AddValue(reader.GetDateTime(i)); } 231 catch (DbException) { columnGroup.Columns.ElementAt(i).AddValue(null); } 232 } else { 233 try { columnGroup.Columns.ElementAt(i).AddValue(reader.GetValue(i).ToString()); } 234 catch (DbException) { columnGroup.Columns.ElementAt(i).AddValue(null); } 235 } 232 236 } 233 237 actRow++; … … 235 239 FireNewRowLoaded(actRow); 236 240 } 241 if (initColumns) { 242 for (int i = 0; i < reader.FieldCount; i++) { 243 if (reader.GetName(i).ToUpper().Contains("ZEIT")) 244 columnGroup.AddColumn(new DateTimeColumn(reader.GetName(i))); 245 else 246 columnGroup.AddColumn(new DoubleColumn(reader.GetName(i))); 247 } 248 } 237 249 reader.Close(); 238 250 } //end using reader
Note: See TracChangeset
for help on using the changeset viewer.