Featured post
.net - Unable to Open .DBF Files in Windows 7 That Had Worked Under XP -
i have vb.net application let me preview .dbf files come in of our clients. application attempts spit out csv file can use in our various environments. application worked under windows xp 32 bit. our company upgraded of windows 7 x64 has caused application fail. verified target build application x86 , not "any cpu" , rebuilt app same issues occur.
it used system.data.odbc
, connection.connectionstring = "driver={microsoft dbase vfp driver (*.dbf)};sourcetype = dbf;sourcedb=" & dbfsourcepath & ";exclusive=no; collate=machine;backgroundfetch=no;"
. location of failure @ connection.open()
. error given is: "error [im001] [microsoft][odbc driver manager] driver not support function".
i noticed drivers vfp not installed , access dbf drivers did not work similar post here. fix listed there install vfpro sp2, however, not have foxpro installs install service pack on top of. tried install oledb driver vfp 9.0 , using system.data.oledb
, connection.connectionstring = "provider=vfpoledb.1;sourcedb=" & dbfsourcepath & ";"
tells me connection.open()
line has error: "feature not available".
i @ complete loss how application work under windows 7 x64. below 2 variants of code file open path removed readability (i have verified path , file exist):
odbc version:
imports system.data.odbc dim strselect string strselect = "select * " & dbfsourcename dim connection new odbc.odbcconnection dim adp new data.odbc.odbcdataadapter connection.connectionstring = "driver={microsoft dbase vfp driver (*.dbf)};sourcetype = dbf;sourcedb=" & dbfsourcepath & ";exclusive=no; collate=machine;backgroundfetch=no;" dim command new odbccommand(strselect, connection) connection.open() ' here throws error.
oledb version:
imports system.data.oledb dim strselect string strselect = "select * " & dbfsourcename dim connection oledbconnection = new oledbconnection() dim adp new data.oledb.oledbdataadapter connection.connectionstring = "provider=vfpoledb.1;sourcedb=" & dbfsourcepath & ";" dim command new oledbcommand(strselect, connection) connection.open() 'error occurs here.
how can use either oledb or odbc connection open these .dbf files under windows 7 x64?
have tried few alternate connection strings? take @ www.connectionstrings.com/dbf-foxpro
connection.connectionstring = _ "provider=microsoft.jet.oledb.4.0;data source=" & _ dbfsourcepath & ";extended properties=dbase iv;"
also see note on using jet access on 64 bit systems
update: alternative using jet driver, can access dbf directly, fortunately file format relatively simple. here existing code project solution demonstrates direct access.
- Get link
- X
- Other Apps
Comments
Post a Comment