# Re: 请问一下，如何用VB连结*.dbf的资料?

Posted by 澳门人 on May 21, 1999 at 00:56:13:

In Reply to: Re: 请问一下，如何用VB连结*.dbf的资料? posted by Jan on May 20, 1999 at 15:34:52:

: : : 如题...试着连结用VFP(6.0)建立出来的.DBF档，但不论是透过ODBC或DATA元件，都无法连结到资料..(会出现"找不到 XBase备忘档案，数目3166"的错误讯息)...
: : : (NT Server (sp4)平台，VB6.0企业版)...请各位帮帮忙....

: :
: : 这样试试吧:

: : if the dbf file path is "c:\dbf\abc.dbf"

: : dim db as database
: : dim rs as recordset
: : dim sCmd as string

: : set db=opendatabase("c:\dbf\abc.dbf",false,false,"foxpro 2.5;")
: : scmd="select * from abc order by field_name"
: : set rs=db.openrecordset(scmd,dbopendynaset)

: : with rs
: : code here
: : end with

: 谢谢您的回答，可是若是Client/Server 架构，且需用到多张table时，此法似乎...

我没有用 dbf database 写过 client/server program, 或许帮不了你, 但若果你想同时开多个table的话,那是否需要每次都connect to database 一次??! 其实事情并不是这样,
cos' set db=opendatabase("c:\dbf\abc.dbf",...) 和
set db=opendatabase("c:\dbf\",...) is the same,
so you only want to connect to the path one time when your program startup,
你可以写一个module include functions,
you can call thoses functions in your design time,
if you want to know more, just post your response,
cos' i don't know whether you are interest with my opinions.

Follow Ups: