我最近完成了一个应用程序,并且已经生成了可执行文件.exe,在我的机子上用一切正常。可是在我把它共享到别人的机子上时,运用却发生错误,提示你文件丢失,这是怎么回事?

解决方案 »

  1.   

    VB程序除了需要自己的.exe文件外,还需要其它一些文件支持,如msvbrun60.dll/msvbrun50.dll;用到了其它控件的话,也需要复制过去且注册;用到了数据库的话还需要相应的数据驱动引擎,如msjet。
    总之,将程序打包,然后再去其它机器上安装。
      

  2.   

    VB6STKIT.DLL,$(WinSysPathSysFile)
    VB6CHS.DLL,$(WinSysPath)
    COMCAT.DLL,$(WinSysPathSysFile)
    STDOLE2.TLB,$(WinSysPathSysFile)
    ASYCFILT.DLL,$(WinSysPathSysFile)
    OLEPRO32.DLL,$(WinSysPathSysFile)
    OLEAUT32.DLL,$(WinSysPathSysFile)
    MSVBVM60.DLL,$(WinSysPathSysFile)
      

  3.   

    我昨天对我生成的可执行文件进行了打包并且安装,可还是一样。安装在我的机子上运行一切正常,可一旦安装到别的机子上又是不行,我已经把该连接的数据库连起来了,有关的dll文件也包进去了,可为什么还是不行呢?急救!
      

  4.   

    提示的出错的是什么问题?
    又提示的是什么文件不存在,
    你在看一下SUPPORT里面有没有那个文件!
    希望你能再说的详细一点,
    最好出错提示的哪个文件找不到?
    这样比较好解答.
      

  5.   

    Dim cnn As Connection, rs As Recordset, nwp As Long
    Dim addrs As String, userid As String, passwd As String
    Dim nwqry As StringPrivate Sub InitializeText()
      '初始化TextBox控件的数据绑定
      Set txtId.DataSource = rs
      Set txtDate.DataSource = rs
      Set txtName.DataSource = rs
      Set txtAds.DataSource = rs
      Set txtCont.DataSource = rs
      Set txtRen.DataSource = rs
      Set txtCust.DataSource = rs
      Set txtPezi.DataSource = rs
      Set txtPrc.DataSource = rs
      Set txtBzq.DataSource = rs
      Set txtSell.DataSource = rs
      Set txtFud.DataSource = rs
      Set txtFuj.DataSource = rs
      Set txtBezu.DataSource = rs
    End Sub
    'Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
       'Provider = "Microsoft.Jet.OLEDB.4.0;" & _
        '      "Data Source=E:\Documents and Settings\administrator" & _
         '     "\My Documents\PuJie.mdb;Persist Security Info=False"
    'End SubPrivate Sub cmdAdd_Click()
      rs.AddNew                      '在客户资料中添加新记录
      InitializeText
    End SubPrivate Sub cmdDel_Click()
     rs.Delete
     rs.UpdateBatch adAffectAll
     InitializeText
    End SubPrivate Sub cmdExit_Click()          '在客户资料中删除已有的记录
      Unload Form2
      Form1.Show
      InitializeText
    End SubPrivate Sub cmdFst_Click()
      rs.MoveFirst
      nwp = 1
      InitializeText
    End SubPrivate Sub cmdLst_Click()
      rs.MoveLast
      nwp = rs.RecordCount
      InitializeText
    End SubPrivate Sub cmdNxt_Click()
      On Error GoTo Down
      rs.MoveNext
      nwp = nwp + 1
    Down:
      InitializeText
    End SubPrivate Sub cmdPvs_Click()
      On Error GoTo Up
      rs.MovePrevious
      nwp = nwp - 1
    Up:
      InitializeText
    End SubPrivate Sub cmdQry_Click()
      Dim query As String, lstr As String
      If txtQry.Text = "" Then
        MsgBox "请输入要查找的公司简称", vbOKOnly + vbInformation, "查询"
        txtQry.SetFocus
        Exit Sub
      End If
      'App.Path
      'flas = "e:\Documents and Settings\administrator" & _
             "\My Documents\PuJie.mdb"
      'flas = App.Path & "\PuJie.mdb"
      
    '==============================模糊查询法=====================================
     ' Dim X As Integer
      query = "select * from 普杰客户资料明细表 Where"
      For X = 1 To Len(txtQry.Text)
            lstr = Left(txtQry.Text, X)
            lstr = Right(lstr, 1)
            If X = 1 Then
                query = query & " 公司名称 LIKE '%" & lstr & "%'"
            Else
                query = query & " AND 公司名称 LIKE '%" & lstr & "%'"
            End If
      Next X
      On Error Resume Next
      rs.Close
      nwqry = query
    '---------------------------------------------------------------------------
    '  Set cnn = CreateObject("ADODB.Connection")
    '  Set rs = CreateObject("ADODB.Recordset")
    '  cnn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DSN=Microsoft" & _
    '          " Access Driver;UID=;PWD=;DBQ=" & flas
        rs.Open query, cnn, adOpenStatic, adLockOptimistic
        nwp = 1
    '      If rs.RecordCount > 0 Then
    '        txtId.Text = IIf(IsNull(rs!流水号) = True, "", rs!流水号)
    '        txtDate.Text = IIf(IsNull(rs!购买日期) = True, "", rs!购买日期)
    '        txtName.Text = IIf(IsNull(rs!公司名称) = True, "", rs!公司名称)
    '        txtAds.Text = IIf(IsNull(rs!公司地址) = True, "", rs!公司地址)
    '        txtCont.Text = IIf(IsNull(rs!联系方式) = True, "", rs!联系方式)
    '        txtRen.Text = IIf(IsNull(rs!联系人) = True, "", rs!联系人)
    '        txtCust.Text = IIf(IsNull(rs!所购商品名称) = True, "", rs!所购商品名称)
    '        txtPezi.Text = IIf(IsNull(rs!详细配置) = True, "", rs!详细配置)
    '        txtPrc.Text = IIf(IsNull(rs!商品价格) = True, "", rs!商品价格)
    '        txtBzq.Text = IIf(IsNull(rs!保质期) = True, "", rs!保质期)
    '        txtSell.Text = IIf(IsNull(rs!销售人员工号) = True, "", rs!销售人员工号)
    '        txtFud.Text = IIf(IsNull(rs!其他附带商品) = True, "", rs!其他附带商品)
    '        txtFuj.Text = IIf(IsNull(rs!附带价格) = True, "", rs!附带价格)
    '        txtBezu.Text = IIf(IsNull(rs!备注) = True, "", rs!备注)
    '      Else
    '        MsgBox "你输入的名称无效!", vbOKOnly + vbExclamation, "查询"
    '        txtQry.Text = "": txtQry.SetFocus
    '        Exit Sub
    '      End If
    '   rs.Close
    '  cnn.Close
      InitializeText
    End SubPrivate Sub cmdSave_Click()
      rs.UpdateBatch adAffectAll
      rs.Close
      rs.Open nwqry, cnn, adOpenStatic, adLockOptimistic
    End SubPrivate Sub Form_Load()
      If Right(App.Path, 1) = "\" Then
        addrs = App.Path & "PuJie.mdb"
      Else
        addrs = App.Path & "\PuJie.mdb"
      End If
      userid = "": passwd = ""
      Set cnn = New Connection
      Set rs = New Recordset
      cnn.Open "DRIVER={Microsoft Access Driver (*.mdb)};" & _
             "DSN=Microsoft Access Driver;UID=" & userid & ";" & _
             "PWD=" & passwd & ";DBQ=" & addrs
      nwqry = "select * from 普杰客户资料明细表 "
      rs.Open nwqry, cn, adOpenStatic, adLockOptimistic
      InitializeText
    End SubPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
      cnn.Close
    End SubPrivate Sub txtAds_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then
        txtCont.SetFocus
      End If
    End SubPrivate Sub txtBzq_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then
        txtSell.SetFocus
      End If
    End SubPrivate Sub txtCont_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then
        txtRen.SetFocus
      End If
    End SubPrivate Sub txtCust_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then
        txtPezi.SetFocus
      End If
    End SubPrivate Sub txtDate_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then
        txtName.SetFocus
      End If
    End SubPrivate Sub txtFud_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then
        txtFuj.SetFocus
      End If
    End SubPrivate Sub txtFuj_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then
        txtBezu.SetFocus
      End If
    End SubPrivate Sub txtName_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then
        txtAds.SetFocus
      End If
    End SubPrivate Sub txtPezi_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then
        txtPrc.SetFocus
      End If
    End SubPrivate Sub txtPrc_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then
        txtBzq.SetFocus
      End If
    End SubPrivate Sub txtRen_KeyPress(KeyAscii As Integer)
       If KeyAscii = 13 Then
        txtCust.SetFocus
      End If
    End SubPrivate Sub txtSell_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then
        txtFud.SetFocus
      End If
    End Sub各位老大,求求你们了。
    这个问题我弄了四五天了,可是始终却没有头绪。我现在把代码附上,请大家指点一下有什么错误。到底在哪一环节出了毛病,是不是真的数据库路径设的有问题呢?我们老板已经发火了,我现在急阿!在线等待。
      

  6.   

    建议把数据库路径改为相对路径,用App.path或App.path + "\db",写到连接字符串里,如果是App.path + "\db",打包时注意改一下数据库文件的路径
      

  7.   

    例如path = App.path + "\db"
    connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path & "\PuJie.mdb;Mode=ReadWrite;Persist Security Info=False"
      

  8.   

    connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.path & "\PuJie.mdb;Mode=ReadWrite;Persist Security Info=False"
    中的app.path很重要
      

  9.   

    To viena(晓琴) :
      请问一下,"\db"指得是什么。
      

  10.   

    VB6STKIT.DLL,$(WinSysPathSysFile)
    VB6CHS.DLL,$(WinSysPath)
    COMCAT.DLL,$(WinSysPathSysFile)
    STDOLE2.TLB,$(WinSysPathSysFile)
    ASYCFILT.DLL,$(WinSysPathSysFile)
    OLEPRO32.DLL,$(WinSysPathSysFile)
    OLEAUT32.DLL,$(WinSysPathSysFile)
    MSVBVM60.DLL,$(WinSysPathSysFile)
    只用这么多就能行了吗?
      

  11.   

    To viena(晓琴) :
       Thank for your help!  
       现在我已经能够把我的程序顺利地安装到别人的机子上,运行也正常。可是又有奇怪的事情出现了。在别人的机子上输入数据,点击保存按钮时,老是会报错。而在我自己的机子上却不存在这样的问题。这到底是怎么回事?
      

  12.   

    是不是装在了NTFS文件系统的分区上,有修改权限吗?右键点文件夹,选属性,安全
      

  13.   

    To viena(晓琴) :
        我不太清楚是不是装在了NTFS文件系统的分区上,反正我没有设定修改权限。到现在还没有想出一个好的办法来.不知道是不是我的代码有什么问题?(cmdSave_Click)
      

  14.   

    To danielinbiti(金): 
         请问数据库参数该怎么看,能否讲的详细一点,我知识水平有限。
      

  15.   

    Private Sub cmdSave_Click()
      rs.UpdateBatch adAffectAllChapters
    End Sub在这段代码中,rs.UpdateBatch adAffectAllChapters 是不是有什么问题。我该怎样修改才能使我的程序运行正常。