首页 > 数据库 > 数据库开发技术 > 判断table列的数据类型
当需要判断table某列的数据类型为double或int时则执行某些操作,语句如下:
[@more@]if ((typeof(double).Equals(ds.Tables[0].Columns[dataGridView1.CurrentCell.ColumnIndex].DataType) == true)||
(typeof(int).Equals(ds.Tables[0].Columns[dataGridView1.CurrentCell.ColumnIndex].DataType) == true))
{
//某些操作语句
}
该语句若放在DataGridView的clickCell事件里面,则实现点击某个Cell则获取相应table的数据类型,若是int或double型则执行某些操作语句。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7946503/viewspace-1003233/ ,如需转载,请注明出处,否则将追究法律责任。