读取DBF文件
下面为一读取DBF文件的实例
Public Function getOwner(Allslope As File, SlopeNo As String) As 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
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
-----------------------------------------------------------
佛对我说:你心里有尘。我用力的拭擦。