本文整理汇总了C#中DataSet.AddVariable方法的典型用法代码示例。如果您正苦于以下问题:C# DataSet.AddVariable方法的具体用法?C# DataSet.AddVariable怎么用?C# DataSet.AddVariable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataSet
的用法示例。
在下文中一共展示了DataSet.AddVariable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillDataSetWithRequest
public static void FillDataSetWithRequest(DataSet ds, ClimateParameter parameter, double[] latmin, double[] latmax, double[] lonmin, double[] lonmax, int[] starthour, int[] stophour, int[] startday, int[] stopday, int[] startyear, int[] stopyear, FetchingOptions options)
{
ds.IsAutocommitEnabled = false;
ds.Metadata[Namings.metadataNameParameter] = Namings.GetParameterName(parameter);
ds.Metadata[Namings.metadataNameCoverage] = Namings.GetCoverageName(parameter);
ds.Metadata[Namings.metadataNameProvenanceHint] = options.FetchClimateProvenanceControlStr;
if (!ds.Variables.Contains(Namings.VarNameLatMax))
ds.AddVariable<double>(Namings.VarNameLatMax, Namings.dimNameCells);
if (!ds.Variables.Contains(Namings.VarNameLatMin))
ds.AddVariable<double>(Namings.VarNameLatMin, Namings.dimNameCells);
if (!ds.Variables.Contains(Namings.VarNameLonMax))
ds.AddVariable<double>(Namings.VarNameLonMax, Namings.dimNameCells);
if (!ds.Variables.Contains(Namings.VarNameLonMin))
ds.AddVariable<double>(Namings.VarNameLonMin, Namings.dimNameCells);
if (!ds.Variables.Contains(Namings.VarNameDayMax))
ds.AddVariable<int>(Namings.VarNameDayMax, Namings.dimNameCells);
if (!ds.Variables.Contains(Namings.VarNameDayMin))
ds.AddVariable<int>(Namings.VarNameDayMin, Namings.dimNameCells);
if (!ds.Variables.Contains(Namings.VarNameHourMax))
ds.AddVariable<int>(Namings.VarNameHourMax, Namings.dimNameCells);
if (!ds.Variables.Contains(Namings.VarNameHourMin))
ds.AddVariable<int>(Namings.VarNameHourMin, Namings.dimNameCells);
if (!ds.Variables.Contains(Namings.VarNameYearMax))
ds.AddVariable<int>(Namings.VarNameYearMax, Namings.dimNameCells);
if (!ds.Variables.Contains(Namings.VarNameYearMin))
ds.AddVariable<int>(Namings.VarNameYearMin, Namings.dimNameCells);
ds.Variables[Namings.VarNameDayMax].Append(stopday);
ds.Variables[Namings.VarNameDayMin].Append(startday);
ds.Variables[Namings.VarNameHourMax].Append(stophour);
ds.Variables[Namings.VarNameHourMin].Append(starthour);
ds.Variables[Namings.VarNameYearMax].Append(stopyear);
ds.Variables[Namings.VarNameYearMin].Append(startyear);
ds.Variables[Namings.VarNameLonMax].Append(lonmax);
ds.Variables[Namings.VarNameLonMin].Append(lonmin);
ds.Variables[Namings.VarNameLatMax].Append(latmax);
ds.Variables[Namings.VarNameLatMin].Append(latmin);
ds.Commit();
}
示例2: CopyRequestedDataSet
public static void CopyRequestedDataSet(DataSet inDs, DataSet outDs, bool commit)
{
foreach (var entry in inDs.Metadata)
outDs.Metadata[entry.Key] = entry.Value;
if (!outDs.Variables.Contains(Namings.VarNameLatMax))
outDs.AddVariable<double>(Namings.VarNameLatMax, Namings.dimNameCells);
if (!outDs.Variables.Contains(Namings.VarNameLatMin))
outDs.AddVariable<double>(Namings.VarNameLatMin, Namings.dimNameCells);
if (!outDs.Variables.Contains(Namings.VarNameLonMax))
outDs.AddVariable<double>(Namings.VarNameLonMax, Namings.dimNameCells);
if (!outDs.Variables.Contains(Namings.VarNameLonMin))
outDs.AddVariable<double>(Namings.VarNameLonMin, Namings.dimNameCells);
if (!outDs.Variables.Contains(Namings.VarNameDayMax))
outDs.AddVariable<int>(Namings.VarNameDayMax, Namings.dimNameCells);
if (!outDs.Variables.Contains(Namings.VarNameDayMin))
outDs.AddVariable<int>(Namings.VarNameDayMin, Namings.dimNameCells);
if (!outDs.Variables.Contains(Namings.VarNameHourMax))
outDs.AddVariable<int>(Namings.VarNameHourMax, Namings.dimNameCells);
if (!outDs.Variables.Contains(Namings.VarNameHourMin))
outDs.AddVariable<int>(Namings.VarNameHourMin, Namings.dimNameCells);
if (!outDs.Variables.Contains(Namings.VarNameYearMax))
outDs.AddVariable<int>(Namings.VarNameYearMax, Namings.dimNameCells);
if (!outDs.Variables.Contains(Namings.VarNameYearMin))
outDs.AddVariable<int>(Namings.VarNameYearMin, Namings.dimNameCells);
outDs.Variables[Namings.VarNameDayMax].Append(inDs.Variables[Namings.VarNameDayMax].GetData());
outDs.Variables[Namings.VarNameDayMin].Append(inDs.Variables[Namings.VarNameDayMin].GetData());
outDs.Variables[Namings.VarNameHourMax].Append(inDs.Variables[Namings.VarNameHourMax].GetData());
outDs.Variables[Namings.VarNameHourMin].Append(inDs.Variables[Namings.VarNameHourMin].GetData());
outDs.Variables[Namings.VarNameYearMax].Append(inDs.Variables[Namings.VarNameYearMax].GetData());
outDs.Variables[Namings.VarNameYearMin].Append(inDs.Variables[Namings.VarNameYearMin].GetData());
outDs.Variables[Namings.VarNameLonMax].Append(inDs.Variables[Namings.VarNameLonMax].GetData());
outDs.Variables[Namings.VarNameLonMin].Append(inDs.Variables[Namings.VarNameLonMin].GetData());
outDs.Variables[Namings.VarNameLatMax].Append(inDs.Variables[Namings.VarNameLatMax].GetData());
outDs.Variables[Namings.VarNameLatMin].Append(inDs.Variables[Namings.VarNameLatMin].GetData());
if (commit)
{
outDs.Commit();
}
}