问题一:
     我使用语句:
       cn.Execute "select * from yjcs where yjmc='" & ElementName & "'"
     将返回多条记录,请问如何将满足一定条件的记录集中的多条记录存放到变量中?问题二:
     my_record.Open "select * from lbyq where bm = '" & my_code & "'", cn
     If Not my_record.EOF Then
        MSHFlexGrid1.TextMatrix(1, 0) = my_record("xh")
     End If
     我在数据库中定义字段xh的类型为char,运行上诉代码时提示:实时错误‘94’,无效使用null。请问这是怎么一回事?问题三:
    在form中添加一ado控件,并在属性框中设置了ConnectString,以及Commandtype和RecordSource属性,但使用下列语句:
    If Form1.Adodc1.Recordset.RecordCount > 0 Then
       Form1.Adodc1.Recordset.MoveFirst      ……    ……   ……    系统提示:“对象变量或with块变量未设置”。该怎样解决?

解决方案 »

  1.   

    第一个问题:
    dim temp
    temp=rs.GetRows
    这样temp就成为了一个包含该记录的二维数组
      

  2.   

    第二个问题:
    my_record("xh")是不是有空值?MSHFlexGrid1.TextMatrix(1, 0)=null当然有问题了。
      

  3.   

    第三个问题:
    不清楚,偶只用ado
      

  4.   

    to kissoflife(明月高楼休独倚,酒入愁肠,化作相思泪!):
       问题一已解决,谢谢。
       对于问题二:字段“xh”的类型为char,可以为空,默认值为none。程序启动时该字段的值可能为null,但是我使用语句:   If my_record("xh") = "" Then
          MSHFlexGrid1.TextMatrix(1, 0) = ""
       Else
          MSHFlexGrid1.TextMatrix(1, 0) = my_record("xh")
       End If还是有同样的错误提示,这是为什么?
      

  5.   

    试试这个:
    If IsNull(my_record("xh")) Then
       MSHFlexGrid1.TextMatrix(1, 0) = ""
    Else
       MSHFlexGrid1.TextMatrix(1, 0) = my_record("xh")
    End If
    判断是否空值不能用"",应该用IsNull函数。
      

  6.   

    第二个问题用iif(isnull(my_record("xh"))=true,"",my_record("xh"))
    第三个可能是因为ado控件的记录没打开