vfp的数据库(.dbc)如何连接access(.mdb)
How do VFP databas (.dbc) connect access (.mdb)? collection
How do VFP databas (.dbc) connect access (.mdb)?
My goal is to keep multiple tables of the VFP databa, multiple
table queries, and save the results to a table in access. How
do?
The net friend a:
Create a remote view connection MDB in DBC (first configure
ODBC), then the derivative;
Connect the MDB with the SPT and ADO, and import the data into
the MDB.
The net friend 2:
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Method 1: using the "file" -> in ACCESS to "get external data"
- > "import"
Reference:
/eg/swf/
/eg/swf/
In this拼音英语 way, sometimes the "external table is not the expected
format", and if prompted for this error, u the following
method:
Open the DBF table with VFP, then COPY TO NEWTABLE TYPE FOX2X,
and then u this method TO try the NEWTABLE import.
2, switch to the ACCESS2003.
Method 2: u the ACCESS of "file" - > "ACCESS to external data"
- > "import", then the file type to choo the ODBC Databa
(), and then lect data > < machine,
Click on the "new" to create a data source, data source type
with "ur data" or "system data" (suggested), and then click家作文400字
"next".
Drivers lect 'Microsoft Visual FoxPro Driver', click 'next',
and click 'finish',
Enter this Data Source Name in the Data Source Name (with a
number of names), which can be lf-determined, such as LjDbf,
Databa Type (Databa Type)
Select the "Free Table directory" (the Free Table Path), and
then t the Path you want to import to the Path in the Path
below, such as "D: ",
Click "ok" to clo the data source configuration window and
lect the DBF table you want to import in the "import object"
window and click "ok".
Method 3: connect ACCESS with VFP and then write the DBF data
to ACCESS with the code. It's just like writing SQL
Method 4: if you have SQL Server installed, you can import the
data (DTS) from the import of SQL Server becau the DTS has
a wizard, which is not covered here.
Method 5: first turn DBF into EXCEL or TXT, then import it with
method one.
Note: the DBF table, if not included in the note field, is
directly ud TO the table name of the COPY TO table. XLS type
xl5 is converted TO EXCEL, and if it contains the note type field,
the following method must be converted TO EXCEL:
* * * * * * *
CLOSE the DATABASES ALL
SET the DATE YMD
The SET CENTURY ON
CDbfFile = GETFILE (" DBF ")
IF the EMPTY (cDbfFile)
The RETURN
ENDIF
USE (cD繁星春水读书笔记 bfFile) ALIAS FoxTable IN 0
IF NOT USED (" FoxTable ")
= MESSAGEBOX (" failed to open the table, the program will abort!
", "Error")
The RETURN
ENDIF
CExcelFile = PUTFILE (" save for (& N) : ", JUSTSTEM (cDbfFile)
+ ".xls ", "XLS"
IF the EMPTY (cExcelFile)
CLOSE the DATABASES ALL
The RETURN
ENDIF
The SELECT FoxTable
OExcelSheet = GETOBJECT (" "" "Excel. Sheet ") & & produces
Excel objects
IF NOT TYPE (" oExcelSheet ") = "O"
= MESSAGEBOX (" the Excel object creation fails, the program
will abort! ", "Error")
The RETURN
ENDIF
OExcelApp = oExcelSheet. APPLICATION
OExcelApp. Workbooks. The ADD ()
OExcelApp. ActiveWindow. WINDOWSTATE = 2
oSheet = Sheet
nFldCount =地区(aFldList“FoxTable”)
i=1到nFldCount
(我)。值= aFldList[1]我
ENDFOR
cRecc = STR(RECCOUNT(“FoxTable”))
扫描
等待窗口ALLTRIM(STR(RECNO())+“/”+cRecc
i=1到nFldCount
vValue = .NULL。
如果在(aFldList i,2,“CDLMNFIBYT”)=0
循环
ENDIF
cFldName = aFldList[1]我
vValue =评估(cFldName)
做的情况下
案例aFldList[2]我= " C " 明亮的英语 & &字符/字符串
vValue =修剪(vValue)
案例aFldList[2]我= " D " & &日期
vValue = DTOC中(vValue)
案例aFldList[2]我=“T”& &日期时间
vValue = TTOC(vValue)
例INLIST(aFldList[2]我,“N”,“F”,“我”、“B”,“Y”)& &
数的值
案例aFldList[2]我= " L " & &逻辑
案例aFldList[2]我=“M”& &备注型
否则
vValue = .NULL。
ENDCASE
如果VARTYPE(vValue)=“C”和空(vValue)
循环
ENDIF
如果不是ISNULL(vValue)
(RECNO(“FoxTable”)+ 1,i)value = vValue
ENDIF
ENDFOR
ENDSCAN
cChrStr = " ABCDEFGHIJKLMNOPQRSTUVWXYZ "
i=1到nFldCount
cColumn=SUBSTR(cChrStr,INT(i-1)/26),1)+SUBSTR(cChrStr,
IIF(MOD(i,26)=0,26,MOD(i,26)),1)
oSheet。列(cColumn+“:”+cColumn)。COLUMNWIDTH = 12
如果aFldList i,2="M"
oSheet。列(cColumn+“:”+cColumn)。WrapText = .F。
ENDIF
ENDFOR
(cExcelFile)
(.F)。
(.F)。
oExcelSheet = .NULL。
oExcelApp = .NULL。
等待明确的
=弹出窗口(“转换完毕!”,64年,“OK”)
关闭数据库的所有
方法三:用VFP连接,然后用代码把DBF数据一条一条写入访问。就像
写入SQL一样
请参考:
答:需配ODBC数据数据源
* - - - - - - - - - - - - - - - - - - 芋头的种植 - - - - - - - - - - - -
odbc的配制方法在这里不再介绍,以下finger3为数据源名
nhandle = SQLCONNECT(事情就让它事情就让它事情就让它
“finger3”,母狼的智慧 ,,,,密事情就让它码,)
如果nhandle < 0
弹出窗口(“数据库连接失败! ! !”,16日'错误信事情就让它息,)
返回
其他的
Ac = SQLEXEC(nhandle“Select * From worker_info”、“Temp1”)
如果交流< 0
弹出窗口(“读取数据错误!”,16日'错误信事情就让它息,)
返回
ENDIF
选择Temp1
浏览
ENDIF
B:无需配ODBC数据数据源,即用字符串方式连接
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
nhandle = SQLSTRINGCONNECT(“司机= { Microsoft Access司机(* .
mdb)}友情的名言 ;dbq = c: ;pwd = ")pwd为数据库密码项
如果nhandle < = 0
弹出窗口(“数据库连接失败! ! !”,16日'错误信事情就让它息,)
返回
其他的
Ac = SQLEXEC(nhandle“Select * From worker_info”、“Temp1”)
如果交流< 0
弹出窗口(“读取数据错误!”,16日'
Error message & apos; )
The RETURN
ENDIF
The SELECT Temp1
The BROWSE
ENDIF
Change the above Select statement to Sacn + Inrt
The net friend three:
U ADO to connect two databas parately, then read the data
from the VFP to the recordt, loop through the recordt, and
write the records to the databa connection where ACCESS is 科技的名言
located.
ADO's article, reference:
/document/viewdoc/? Id = 1215
/document/viewdoc/? Id = 610
This article is from the CSDN blog, which is reproduced here
at
/wuzoujing/archive/2008/07/16/2658840.a
spx
本文发布于:2023-04-28 07:57:02,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/fan/82/519011.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |