代码如下:
'If ListView1.SelectedItem.Text <> " " Then
        'Dim FileName As String
        'Dim a As Long
        'conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=db1.mdb;Jet OLEDB:Database Password=1234"
        'Rs.Open "select * from file1", conn, adOpenKeyset, adLockPessimistic  '打开数据库的表
        'FileName = ListView1.SelectedItem.Text
        'If FileName = "" Then
            'Exit Sub
        'End If
    'End If
    'Call ShellExecute(hwnd, "Open", App.Path & "\" & ListView1.SelectedItem.Text, "", App.Path, 1)希望实现的功能:文件在数据库中用超级链接的方式存储,在listview里能够打开文件

解决方案 »

  1.   

    ListView1.SelectedItem.Text 显示的是什么文字?
      

  2.   

    文件格式是什么呢?excel,word....,
      

  3.   

    给你几个函数,绝对能用 
    '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    '函数功能:连接指定的数据库 
    '参数说明:cnnP:数据库连接对象; 
    '        :adoP:数据集存储对象; 
    '        :strPath:数据库路径; 
    '        :strPassword:数据库密码; 
    '返回说明:True:连接成功  False:连接失败 
    '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    Public Function funConnectDataBase(cnnP As ADODB.Connection, adoP As ADODB.Recordset, ByVal strPath As _ 
        String, ByVal strPassword As String) As Boolean 
    On Error GoTo errFunction 
        Set cnnP = New ADODB.Connection 
        Set adoP = New ADODB.Recordset 
        cnnP.Provider = "Microsoft.Jet.OLEDB.4.0" 
        cnnP.Open "Data Source = " & strPath & ";jet oledb:database password=" & strPassword 
        funConnectDataBase = True 
        Exit Function 
    errFunction: 
        funConnectDataBase = False 
    End Function 
    '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    '函数功能:关闭数据库连接对象和数据文件的关联 
    '参数说明:cnnP:数据库连接对象; 
    '        :adoP:数据库存储对象; 
    '返回说明:True:关闭连接成功  False:关闭连接失败 
    '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    Public Function funCloseDataBase(cnnP As ADODB.Connection, adoP As ADODB.Recordset) As Boolean 
    On Error GoTo errFunction 
        Set adoP = Nothing 
        Set cnnP = Nothing 
        funCloseDataBase = True 
        Exit Function 
    errFunction: 
        funCloseDataBase = False 
    End Function 
    '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    '过程功能:对指定的对象执行指定的SQL语句 
    '参数说明:cnnP:ADO连接对象 
    '        :adoP:ADO记录集对象 
    '        :strSql:SQL语句 
    '        :bolQueryRecord:是否是查询记录集 
    '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Public Sub subExcuteSQL(cnnP As ADODB.Connection, adoP As ADODB.Recordset, strSql As String, bolQueryRecord _ 
        As Boolean) 
        If bolQueryRecord Then  '如果是查询记录集 
            adoP.Open strSql, cnnP, adOpenStatic, adLockBatchOptimistic 
        Else 
            cnnP.Execute strSql 
        End If 
    End Sub 
      

  4.   

    很简单阿,你设一个字符串类型的字段,然后把要打开的文件名连同路径保存在这个字段中
    读的时候用SHELL运行这个字符串,系统就会自动打开它了
      

  5.   

        Shell "start.exe http://www.baidu.com/", vbHide '这个可以打开连接
    示例
        FileName = ListView1.SelectedItem.Text 
        Shell "start.exe " & FileName, vbHide