PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Help with connecting to FoxPro please
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Help with connecting to FoxPro please
![]() |
Help with connecting to FoxPro please |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hello,
I am trying to connect to a visual fox pro table from my asp.net page. I dragged an odbc connection and set it to a visual fox pro driver file dsn pointing to "mydocuments" folder. Here is the connection string SourceDB=c:\Documents and Settings\bgunay\My Documents;PWD=;SourceType=DBF;Collate=Machine;Deleted=Yes;BackgroundFetch=Y*es;Exclusive=No;Driver=Microsoft Visual FoxPro Driver;Null=Yes;UID= I then dragged an odbc command and set it to this connection. I was then able to see the list of visual fox pro(.dbf) tables in "my documents" folder. I then set the query to command text to return every record from the "corp" table. Then, I executed the command as follows cnn.Open() Dim reader As Odbc.OdbcDataReader reader = OdbcCommand.ExecuteReader() While reader.Read Response.Write(reader.Item(0) & "<br>") End While It came back with "Corp.dbf does not exist" which is so bizarre since corp.dbf exists and is visible when I build the odbc command. But for some reason when I try to select records from it from the code behind, I get that weird message. Any ideas? Thanks, Burak |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Hi Burak,
First off, you might do better with the FoxPro and Visual FoxPro OLE DB data provider, downloadable from msdn.microsoft.com/downloads/updates . Over the years new data features have been added to FoxPro data files and some features are not ODBC compatible. Second, is there a DBC file present in your directory? This is a "Database Container" which contains metadata about the tables. If it's present your connection string should point to it and not just to the free table directory where the tables are. A minimal connection string for a free table directory looks like "Provider=VFPOLEDB.1;Data Source=C:\Temp\;" and for a DBC: "Provider=VFPOLEDB.1;Data Source=C:\Temp\MyDBC.dbc;". You'll get the defaults for everything else. Third, lots of people have problems with ASP due to permissions. The account that your ASP code runs under must have permission to the directory where the data lies. Can you paste your code into a VB Console Application and run it? (Change Response.Write to Console.WriteLine.) -- Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP cindy_winegarden@msn.com www.cindywinegarden.com "Burak Gunay" <burak30@aol.com> wrote in message news:1139326174.102282.246240@g14g2000cwa.googlegroups.com... I am trying to connect to a visual fox pro table from my asp.net page. I dragged an odbc connection and set it to a visual fox pro driver file dsn pointing to "mydocuments" folder. Here is the connection string SourceDB=c:\Documents and Settings\bgunay\My Documents;PWD=;SourceType=DBF;Collate=Machine;Deleted=Yes;BackgroundFetch=Y*es;Exclusive=No;Driver=Microsoft Visual FoxPro Driver;Null=Yes;UID= I then dragged an odbc command and set it to this connection. I was then able to see the list of visual fox pro(.dbf) tables in "my documents" folder. I then set the query to command text to return every record from the "corp" table. cnn.Open() Dim reader As Odbc.OdbcDataReader reader = OdbcCommand.ExecuteReader() While reader.Read Response.Write(reader.Item(0) & "<br>") End While It came back with "Corp.dbf does not exist" which is so bizarre since corp.dbf exists and is visible when I build the odbc command. But for some reason when I try to select records from it from the code behind, I get that weird message. |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Hi Cindy, I talked to my project manager and this is what she told me "Use the dbaseIV connection string below instead of visual foxpro. Our tables are not truly visual foxpro tables. I use this connection string and a simple Select query and it works. Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\upload;Extended Properties=dBASE IV" This worked but the interesting thing was I had to create the upload directory and place the .dbf file there. It did not like "my documents" or "desktop" directories for some reason. Maybe it's some kind of access issue. My next issue is this: I created a dts package to update this .dbf file in the upload directory. I have it so that the dts package will delete the existing .dbf file and create it again, so we won't have duplicate data. But for some reason, when I run the package the table is neve rgettign deleted, only appended to. Do you know why this might be? Thank you, Burak |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Hi Burak,
dBase IV is an older technology and I'm sure it's looking for 8 character directories and an 8.3 type file name. That's why it doesn't like the long paths with spaces in them. Your other question is how to make a DTS package delete a file. I think that's better answered in a SQL Server newsgroup. -- Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP cindy_winegarden@msn.com www.cindywinegarden.com "Burak Gunay" <burak30@aol.com> wrote in message news:1139331407.956433.316390@z14g2000cwz.googlegroups.com... > This worked but the interesting thing was I had to create the upload > directory > and place the .dbf file there. It did not like "my documents" or > "desktop" directories > for some reason. Maybe it's some kind of access issue. > > My next issue is this: I created a dts package to update this .dbf > file in the > upload directory. I have it so that the dts package will delete the > existing .dbf > file and create it again, so we won't have duplicate data. > > But for some reason, when I run the package the table is neve rgettign > deleted, only appended to. |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

