问题:当从sql数据库中select数据集后,如何判断某字段的类型?
解决:
foreach (System.Data.DataColumn dc in dsFirst.Tables[0].Columns)
{
if (s == dc.ColumnName && dc.DataType == typeof(DateTime))
{
strTemp = strTemp + " cstr(" + s + ")+";
break;
}
else if (s == dc.ColumnName)
{
strTemp = strTemp + "[" + s + "]+";
break;
}
}