使用sql的系统表,把该表的所有字段类型进行遍历判断!
方法如下:
select c.name as 字段名
,t.name 数据类型
,c.prec as 长度
,p.value as 描述信息
,m.text as 默认值
from syscolumns c
inner join systypes t on c.xusertype=t.xusertype
left join sysproperties p on c.id=p.id and c.colid = p.smallid
left join syscomments m on c.cdefault=m.id
where objectproperty(c.id,'IsUserTable')=1
and object_name(c.id) ='表的名字'
比如说吧:
dim myrow as datarow
For Each myrow In ds.Tables("aa").Rows
Dim j As Integer
For j = 0 To ds.Tables("aa").Columns.Count - 1
If myrow(j) Is System.DBNull.Value Then '如果是空值跳过
Else
myitem(j) = myrow(j)
End If
Next
Next
这个方法可以过滤ds.Tables("aa")表中的空值
但假如表中字段有一些是二进制的值该如何过滤掉,或者是其他类型的呢?
因为字段的类型不是有:整型,字符型,日期型,二进制....假如能够按自己所需的
筛选出来不是很好吗
我想把他们整理出来,用了解的多一点的人吗?