如果数据库中数据为空,要选判断一下数据的类型
If Not ds.Tables("file").Rows(0).Item(5).GetType Is System.DBNull.Value.GetType Then
或者
If not rs("advert") is DBNull.Value then
这样便可解决了