本文整理匯總了C#中System.Data.DataTable.get_Columns方法的典型用法代碼示例。如果您正苦於以下問題:C# DataTable.get_Columns方法的具體用法?C# DataTable.get_Columns怎麽用?C# DataTable.get_Columns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Data.DataTable
的用法示例。
在下文中一共展示了DataTable.get_Columns方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetFileTypes
public static ICollection GetFileTypes()
{
DataTable dataTable = new DataTable("FileTypes");
dataTable.get_Columns().Add(new DataColumn(Constants.DropDownColumnTypes.Val, typeof(string)));
dataTable.get_Columns().Add(new DataColumn(Constants.DropDownColumnTypes.Text, typeof(string)));
DataRow dataRow = dataTable.NewRow();
dataRow.set_Item(0, 1);
dataRow.set_Item(1, Constants.FileType.VBF.ToString());
dataTable.get_Rows().Add(dataRow);
return new DataView(dataTable);
}
示例2: GetParamDisplayTypes
public static ICollection GetParamDisplayTypes()
{
DataTable dataTable = new DataTable("Parameters");
dataTable.get_Columns().Add(new DataColumn(Constants.DropDownColumnTypes.Val, typeof(string)));
dataTable.get_Columns().Add(new DataColumn(Constants.DropDownColumnTypes.Text, typeof(string)));
DataRow dataRow = dataTable.NewRow();
dataRow.set_Item(0, 1);
dataRow.set_Item(1, Constants.ParamViewType.Decimal.ToString());
dataTable.get_Rows().Add(dataRow);
dataRow = dataTable.NewRow();
dataRow.set_Item(0, 2);
dataRow.set_Item(1, Constants.ParamViewType.Hex.ToString());
dataTable.get_Rows().Add(dataRow);
dataRow = dataTable.NewRow();
dataRow.set_Item(0, 3);
dataRow.set_Item(1, Constants.ParamViewType.Binary.ToString());
dataTable.get_Rows().Add(dataRow);
return new DataView(dataTable);
}
示例3: GetSets
public static ICollection GetSets(int vehicleBuild, int noOfBytes, ref int lastParam, int buildType)
{
DataSet parameterSets = DataAccess.GetParameterSets(vehicleBuild, buildType);
DataTable dataTable = new DataTable("Parameters");
dataTable.get_Columns().Add(new DataColumn(Constants.DropDownColumnTypes.Val, typeof(string)));
dataTable.get_Columns().Add(new DataColumn(Constants.DropDownColumnTypes.Text, typeof(string)));
int count = parameterSets.get_Tables().get_Item(0).get_Rows().get_Count();
if (count > 0)
{
lastParam = int.Parse(parameterSets.get_Tables().get_Item(0).get_Rows().get_Item(count - 1).get_Item(0).ToString());
for (int i = 1; i <= lastParam; i += noOfBytes)
{
DataRow dataRow = dataTable.NewRow();
dataRow.set_Item(0, i);
dataRow.set_Item(1, i + " to " + (i + (noOfBytes - 1)));
dataTable.get_Rows().Add(dataRow);
}
return new DataView(dataTable);
}
throw new CarConfigException("No parameters have been defined for this block! It therefore should not be defined against this vehicle!");
}
示例4: GetVehicleBuild
public static ICollection GetVehicleBuild(bool showAll)
{
DataSet vehicleBuild = DataAccess.GetVehicleBuild(showAll);
DataTable dataTable = new DataTable("Vehicles");
dataTable.get_Columns().Add(new DataColumn(Constants.DropDownColumnTypes.Val, typeof(string)));
dataTable.get_Columns().Add(new DataColumn(Constants.DropDownColumnTypes.Text, typeof(string)));
DataRow dataRow = dataTable.NewRow();
dataRow.set_Item(0, 0);
dataRow.set_Item(1, "Select Vehicle...");
dataTable.get_Rows().Add(dataRow);
int count = vehicleBuild.get_Tables().get_Item(0).get_Rows().get_Count();
if (count > 0)
{
IEnumerator enumerator = vehicleBuild.get_Tables().get_Item(0).get_Rows().GetEnumerator();
try
{
while (enumerator.MoveNext())
{
DataRow dataRow2 = (DataRow)enumerator.get_Current();
dataRow = dataTable.NewRow();
dataRow.set_Item(0, dataRow2.get_Item("fldID"));
dataRow.set_Item(1, dataRow2.get_Item("fldText"));
dataTable.get_Rows().Add(dataRow);
}
}
finally
{
IDisposable disposable = enumerator as IDisposable;
if (disposable != null)
{
disposable.Dispose();
}
}
}
return new DataView(dataTable);
}
示例5: GetFiles
public static ICollection GetFiles(bool blankLead, string templateFolder)
{
DirectoryInfo directoryInfo = new DirectoryInfo(templateFolder);
DataTable dataTable = new DataTable();
dataTable.get_Columns().Add(new DataColumn("File", typeof(string)));
dataTable.get_Columns().Add(new DataColumn("FullName", typeof(string)));
dataTable.get_Columns().Add(new DataColumn("URL", typeof(string)));
if (directoryInfo.get_Exists())
{
if (blankLead)
{
DataRow dataRow = dataTable.NewRow();
dataRow.set_Item(0, Constants.Unassigned);
dataTable.get_Rows().Add(dataRow);
}
FileSystemInfo[] files = directoryInfo.GetFiles("*.*");
if (files.Length > 0)
{
FileSystemInfo[] array = files;
for (int i = 0; i < array.Length; i++)
{
FileSystemInfo fileSystemInfo = array[i];
DataRow dataRow = dataTable.NewRow();
dataRow.set_Item(0, fileSystemInfo.get_Name().ToLower());
dataRow.set_Item(1, fileSystemInfo.get_FullName());
dataRow.set_Item(2, Constants.Config.TemplateFolder + "/" + fileSystemInfo.get_Name());
dataTable.get_Rows().Add(dataRow);
}
}
return new DataView(dataTable);
}
throw new CarConfigException("Template area does not exist");
}
示例6: GetSpecTypes
public static ICollection GetSpecTypes()
{
DataTable dataTable = new DataTable();
dataTable.get_Columns().Add(new DataColumn(Constants.DropDownColumnTypes.Val, typeof(string)));
dataTable.get_Columns().Add(new DataColumn(Constants.DropDownColumnTypes.Text, typeof(string)));
DataRow dataRow = dataTable.NewRow();
dataRow.set_Item(0, 1);
dataRow.set_Item(1, Constants.SpecType.T5.ToString());
dataTable.get_Rows().Add(dataRow);
dataRow = dataTable.NewRow();
dataRow.set_Item(0, 2);
dataRow.set_Item(1, Constants.SpecType.EUCD.ToString());
dataTable.get_Rows().Add(dataRow);
dataRow = dataTable.NewRow();
dataRow.set_Item(0, 3);
dataRow.set_Item(1, Constants.SpecType.Multican.ToString());
dataTable.get_Rows().Add(dataRow);
return new DataView(dataTable);
}
示例7: GetDataSourceSelector
public static ICollection GetDataSourceSelector(DataSet gds, int valField, int textField)
{
DataTable dataTable = new DataTable(gds.get_Tables().get_Item(0).get_TableName());
dataTable.get_Columns().Add(new DataColumn(Constants.DropDownColumnTypes.Val, typeof(string)));
dataTable.get_Columns().Add(new DataColumn(Constants.DropDownColumnTypes.Text, typeof(string)));
DataRow dataRow = dataTable.NewRow();
dataRow.set_Item(0, 0);
dataRow.set_Item(1, Constants.Unassigned);
dataTable.get_Rows().Add(dataRow);
int count = gds.get_Tables().get_Item(0).get_Rows().get_Count();
if (count > 0)
{
IEnumerator enumerator = gds.get_Tables().get_Item(0).get_Rows().GetEnumerator();
try
{
while (enumerator.MoveNext())
{
DataRow dataRow2 = (DataRow)enumerator.get_Current();
dataRow = dataTable.NewRow();
dataRow.set_Item(0, dataRow2.get_Item(valField));
dataRow.set_Item(1, dataRow2.get_Item(textField));
dataTable.get_Rows().Add(dataRow);
}
}
finally
{
IDisposable disposable = enumerator as IDisposable;
if (disposable != null)
{
disposable.Dispose();
}
}
}
return new DataView(dataTable);
}
示例8: GetParameterOptions
public static DataSet GetParameterOptions(int paramId, int thisParamVal, DataSet optionDS)
{
int maskI = 255;
DataSet dataSet = new DataSet();
DataTable dataTable = new DataTable();
IEnumerator enumerator = optionDS.get_Tables().get_Item(0).get_Columns().GetEnumerator();
try
{
while (enumerator.MoveNext())
{
DataColumn dataColumn = (DataColumn)enumerator.get_Current();
dataTable.get_Columns().Add(new DataColumn(dataColumn.get_ColumnName(), dataColumn.get_DataType()));
}
}
finally
{
IDisposable disposable = enumerator as IDisposable;
if (disposable != null)
{
disposable.Dispose();
}
}
dataTable.get_Columns().Add(new DataColumn("Selected", typeof(bool)));
dataTable.get_Columns().Add(new DataColumn("ValueText", typeof(string)));
dataTable.get_Columns().Add(new DataColumn("Checked", typeof(string)));
enumerator = optionDS.get_Tables().get_Item(0).get_Rows().GetEnumerator();
try
{
while (enumerator.MoveNext())
{
DataRow dataRow = (DataRow)enumerator.get_Current();
int num = Convert.ToInt32(dataRow.get_Item("fldParamGroupID"));
int num2 = Convert.ToInt32(dataRow.get_Item("fldOptionVal"));
int num3 = Convert.ToInt32(dataRow.get_Item("fldTypeID"));
try
{
maskI = Convert.ToInt32(dataRow.get_Item("fldMask").ToString(), 2);
}
catch
{
maskI = 255;
}
switch (num3)
{
case 1:
case 4:
{
DataRow dataRow2 = dataTable.NewRow();
IEnumerator enumerator2 = optionDS.get_Tables().get_Item(0).get_Columns().GetEnumerator();
try
{
while (enumerator2.MoveNext())
{
DataColumn dataColumn2 = (DataColumn)enumerator2.get_Current();
dataRow2.set_Item(dataColumn2.get_ColumnName(), dataRow.get_Item(dataColumn2.get_ColumnName()));
}
}
finally
{
IDisposable disposable = enumerator2 as IDisposable;
if (disposable != null)
{
disposable.Dispose();
}
}
string text = "0x" + num2.ToString("X2");
bool flag;
if (num3 == 1)
{
flag = Common.IsSelected(maskI, num2, thisParamVal);
}
else
{
flag = ((num2 & thisParamVal) == num2);
}
dataRow2.set_Item("Selected", flag);
if (flag)
{
dataRow2.set_Item("Checked", "Checked");
}
dataRow2.set_Item("ValueText", text);
dataTable.get_Rows().Add(dataRow2);
break;
}
case 2:
{
num = 1;
int i = 48;
while (i < 122)
{
if (i <= 57 || (i >= 65 && i <= 90) || i >= 97)
{
DataRow dataRow3 = dataTable.NewRow();
string text = Convert.ToChar(i).ToString();
bool flag = Common.IsSelected(maskI, i, thisParamVal);
dataRow3.set_Item("fldOptionVal", i);
dataRow3.set_Item("fldTypeID", num3);
dataRow3.set_Item("fldTypeDesc", Constants.OptionType.ASCII.ToString());
dataRow3.set_Item("fldFullDesc", text);
dataRow3.set_Item("fldOptionGroup", 1);
//.........這裏部分代碼省略.........