Accessing DBF FoxPro on Network

G

Guest

Hi All

I am trying to access a Fox Pro Free Table on the network as follow

Dim cmd As New OdbcCommand
Dim conn As OdbcConnection = New OdbcConnection("Driver={Microsoft Visual FoxPro Driver};" &
"SourceType=DBF;" &
"SourceDB=L:\my_mapped_folder_on_the_network_where_DBF_file_exists\;" &
"Exclusive=No"
If conn.State = ConnectionState.Closed Then conn.Open(
cmd.CommandText = "select * from freetable
cmd.CommandType = CommandType.Tex
cmd.CommandTimeout = 120 '-- 2 minutes
cmd.Connection = con
conn.Open(
Dim ds As DataSet = New DataSe
Dim da As New OdbcDataAdapter(cmd
Tr
'--- Fill the DataSe
da.Fill(ds
Catch ex As Exceptio
' Close the connection when done with it
If conn.State = ConnectionState.Open Then conn.Close(
ErrorMessage = ex.Message 'In web.config Redirect to Error message pag
Throw New Exceptio
Finall
cmd.Dispose(
da.Dispose(
' Close the connection when done with it
If conn.State = ConnectionState.Open Then conn.Close(
End Tr

However I get this error message
ERROR [42S02] [Microsoft][ODBC Visual FoxPro Driver]File 'cashblk.dbf' does not exist

If I copy the 'cashblk.dbf' and the 'cashblk.fpt' on one of local drives as
Dim conn As OdbcConnection = New OdbcConnection("Driver={Microsoft Visual FoxPro Driver};" &
"SourceType=DBF;" &
"SourceDB=C:\my_drive_where_I_copied_the_free_table;" &
"Exclusive=No"

In works! BUT I really would like to know why it won't work if I use the network as well as why do I get the error message and finally how I can resolve it or work around it

I will truly appreciate input on this topic

Sincerely

Yama Kamyar
Sr. Microsoft .NET Consultant
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top