ITPub博客

首页 > 数据库 > 数据库开发技术 > 判断table列的数据类型

判断table列的数据类型

原创 数据库开发技术 作者:ebreezee 时间:2008-05-02 19:59:13 0 删除 编辑

当需要判断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/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    26
  • 访问量
    103236