我的Excel文件中有一个列为显示产品编号,其中数据有这三种XXXX-XXXX,XXXX,和空的
我读取近来后,为什么DateGrid中显示的XXXX这一类型的产片编号为空,这条记录有的,就是这一字段为空~X为数字谢谢大家帮忙解决下

解决方案 »

  1.   

    你是怎么绑定DataGrid的?代码是怎么写的?
      

  2.   

    你试试吧,好用的
       Dim WithEvents adoPrimaryRS As Recordset '数据库连接对象   'strsql 是你的查询语句
       strsql="select 字段 from 表"
       Set Db = New Connection
       Db.CursorLocation = adUseClient
       '下面的连接数据字符串你要修改一下
       Db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\计划管理系统.mdb;Persist Security Info=False"
       Set adoPrimaryRS = New Recordset
       adoPrimaryRS.Open strsql, Db, adOpenStatic, adLockOptimistic
       Set DataGrid1.DataSource = adoPrimaryRS