请各位帮忙看看  为什么取最大值的时候
为什么提示dars.Fields("dtsqe")在对应所需名称或集合序数中,未找到项目~~
求教了~~~~dasql = " select max(dtsqe) as dtsql from test_item_ab_type where testid='" & testid & "' and test_item_ab='" & test_item_ab & "' and test_item_id ='" & test_item_id & "'"
    dars.CursorLocation = adUseClient
    dars.CursorType = adOpenStatic
    Set dasql = dbconn.Execute(dasql)
      MsgBox dars.Fields("dtsqe")

解决方案 »

  1.   

    要用SQL语句中max(dtsqe) as dtsql 的别名dtsql:
    MsgBox dars.Fields("dtsql")
      

  2.   

    因为你没有用dars连接到你的dbconn上dars.open dasql,dbconn,adopenstaticSet dasql = dbconn.Execute(dasql)
    MsgBox dars.Fields("dtsql")
      

  3.   

    dasql = " select max(dtsqe) as dtsql from test_item_ab_type where testid='" & testid & "' and test_item_ab='" & test_item_ab & "' and test_item_id ='" & test_item_id & "'" 
    Set dars = dbconn.Execute(dasql)      
    MsgBox dars.Fields("dtsql")
      

  4.   

    Set dasql = dbconn.Execute(dasql)  '<--这一行的Set dasql 改为Set dars 
    MsgBox dars.Fields("dtsql")