一.VB6.0支持通过ADO数据控件以ODBC方式连接由包含*.DBF表的VFP的*.DBC数据库.所以你可将DBASE数据表由VFP建立项目生成*.DBC数据库,将*.DBF表加入该数据库.
二.也可用DATA控件单独连接*.DBF表.
以下给出一段源代码:
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=jwl_dbf"
Adodc1.RecordSource = "select cs.js_dm,cs.备件代码,cs.备件名称,cs.备件规格,cs.进口计算机号,cs.最低库存量,sl.结存数量,sl.结存金额,sl.结存单价,sl.类别代码 from JWCK_BM as cs,jwl_jiec as sl" & _
" where cs.备件代码 = sl.备件代码" & " and cs.备件代码>" & "''" & " order by sl.类别代码,sl.备件代码"
Adodc1.Refresh
DataGrid1.Refresh
zsl = Adodc1.Recordset.RecordCount
Adodc3.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=jwl_dbf"
Adodc3.RecordSource = "select sum(结存金额) as hj from jwl_jiec"
Adodc3.Refresh
End Sub