我用ADODC控件+MSHFlexGrid控件访问ACCESS表.在本机器上调试通过,可以查询和显示.把程序拷贝到被的机器运行,发现点查询后,没有反映,MSHFlexGrid控件没有任何显示,为什么啊. 环境是VB6+office2000.高手帮忙解决,在线等....

解决方案 »

  1.   

    控件 都copy 到别的机器上没有啊
      

  2.   

    检查你的adodc控件连接数据库的路径
      

  3.   

    Private myConn As New ADODB.Connection
    Private myRecord As New ADODB.Recordset
    Option Explicit
    Private conADO As Connection
    Private rsADO As Recordset
    Private Sub Command1_Click()
    Dim curTime As String
    Dim curmonth, curday, curhour, curminute, cursecond As String
    curTime = Text1.Text
    curmonth = IIf(Month(curTime) < 10, "0" & Month(curTime), Month(curTime))
    curday = IIf(Day(curTime) < 10, "0" & Day(curTime), Day(curTime))
    Text1.Text = Year(curTime) & "-" & curmonth & "-" & curdaycurTime = Text2.Text
    curmonth = IIf(Month(curTime) < 10, "0" & Month(curTime), Month(curTime))
    curday = IIf(Day(curTime) < 10, "0" & Day(curTime), Day(curTime))
    Text2.Text = Year(curTime) & "-" & curmonth & "-" & curdayDim biaoname As String
    '"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Files\水浒Q传数据库\数据库备份\" + Combo1.Text + ".mdb;Persist Security Info=False"
    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\db1.mdb;Persist Security Info=False"Adodc1.RecordSource = "select ALM_DESCR as 描述,ALM_VALUE AS 值,ALM_DATEIN AS 报警开始日期,ALM_TIMEIN AS 报警开始时间,FIXAL.ALM_ALMSTATUS as 报警状态 from FIXAL where ALM_DESCR like '%" & Combo1.Text & "%' and ALM_DATEIN >= '" + Text1.Text + "' and ALM_DATEIN <= '" + Text2.Text + "'"
    On Error GoTo ConnErr
        Adodc1.Refresh
        MSHFlexGrid1.Refresh
        Exit Sub
    ConnErr:
        MsgBox "数据库连接错误!", vbExclamation, "错误"
    End Sub控件都在机器上注册过了
      

  4.   

    代码就这个  帮忙看看   路径也没问题吧   
    Private myConn As New ADODB.Connection
    Private myRecord As New ADODB.Recordset
    Option Explicit
    Private conADO As Connection
    Private rsADO As Recordset
    Private Sub Command1_Click()
    Dim curTime As String
    Dim curmonth, curday, curhour, curminute, cursecond As String
    curTime = Text1.Text
    curmonth = IIf(Month(curTime) < 10, "0" & Month(curTime), Month(curTime))
    curday = IIf(Day(curTime) < 10, "0" & Day(curTime), Day(curTime))
    Text1.Text = Year(curTime) & "-" & curmonth & "-" & curdaycurTime = Text2.Text
    curmonth = IIf(Month(curTime) < 10, "0" & Month(curTime), Month(curTime))
    curday = IIf(Day(curTime) < 10, "0" & Day(curTime), Day(curTime))
    Text2.Text = Year(curTime) & "-" & curmonth & "-" & curdayDim biaoname As StringAdodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\db1.mdb;Persist Security Info=False"Adodc1.RecordSource = "select ALM_DESCR as 描述,ALM_VALUE AS 值,ALM_DATEIN AS 报警开始日期,ALM_TIMEIN AS 报警开始时间,FIXAL.ALM_ALMSTATUS as 报警状态 from FIXAL where ALM_DESCR like '%" & Combo1.Text & "%' and ALM_DATEIN >= '" + Text1.Text + "' and ALM_DATEIN <= '" + Text2.Text + "'"
    On Error GoTo ConnErr
        Adodc1.Refresh
        MSHFlexGrid1.Refresh
        Exit Sub
    ConnErr:
        MsgBox "数据库连接错误!", vbExclamation, "错误"
    End Sub
    本机器运行没问题
      

  5.   

    代码正常,你单步调试走一下看看。另外Formt(curtime,"YYYY-MM-DD")即可把curtime转换成2006-02-02的格式
      

  6.   

    “把程序拷贝到被的机器运行”不知道这是什么意思?程序是要打包发布的,光拷贝exe是不行的。
      

  7.   

    我运行后提示"找不到可安装的ISAM",是什么意思?