读取DBF文件

下面为一读取DBF文件的实例

Public Function getOwner(Allslope As File, SlopeNo As StringAs String
   
    
Dim con As ADODB.Connection
    
Set con = New ADODB.Connection
    
Dim rs As ADODB.Recordset
    
Set rs = New ADODB.Recordset
 
    con.Open 
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & GetName(Allslope.path, 0& ";Extended Properties=dBASE III"
    rs.Open 
"select first_owne from [" & GetName(Allslope.path, 2& "] where slopeno='" & SlopeNo & "'", con
    
Dim pOwner As String
    pOwner 
= ""
    
While Not rs.EOF
        pOwner 
= rs.Fields(0)
        rs.MoveNext
    Wend
  
   getOwner 
= pOwner
   
    
    rs.Close
    
Set rs = Nothing
    con.Close
    
Set con = Nothing
End Function

 

posted on 2009-04-23 09:58  炜升  阅读(390)  评论(0编辑  收藏  举报