473,322 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

using foxpro table from VB.net 2005 with oledb

cj
We have a legacy accounting system (not developed in house) here that
happens to be written in Visual FoxPro. One of the tables has an index
that is actually a coded function COMPANY1 &&"G_RETSDX(COMPANY)".
When I try to use this table in VFP I get an error message "File
'g_retsdx.prg' does not exist." I click ok and continue on. We've
developed many VFP programs outside the accounting system that use this
table and we have to include the function g_retsdx in each of them so
this index will be set and this error will not occur.

Now I need to write a web service that will use this table using VB.net
2005. I set up the connection and commands but when I go to execute a
command, even fill a datatable, I get an exception that says, you
guessed it, "File 'g_retsdx.prg' does not exist." How do I get around this?

I'm sure I could ignore the thrown exception but... I take it Oledb is
capable of reading the indexes of foxpro tables and would update those
indexes if a record was added or deleted. Since I'd be ignoring an
error on one of the many indexes in that CDX I would think it would
corrupt the CDX if I added or deleted a record. And I can't have that
happen.

I'm cross posting this in foxpro and vb.net and I really could use some
advice.

Thanks.

P.S. This is what the VFP foxpro function g_retsdx.prg is:
FUNCTION g_retsdx
PARAMETERS lc_field

*-- Trace call and assertion test removed to permit out of system USE

*-- Declare local variables private
PRIVATE lc_fld1, ;
lc_fld2, ;
lc_fld3, ;
lc_sndxpr

*-- Initialize values for three pieces of lc_field
lc_fld1 = ""
lc_fld2 = ""
lc_fld3 = ""

*-- Remove leading blanks
lc_field = LTRIM(lc_field)

*-- Define the three pieces prior to SOUNDEX conversion
IF LEN(lc_field) 0

*-- If more than one word in string
IF " " $ lc_field
*-- Setup first word
lc_fld1 = LEFT(lc_field, AT(" ", lc_field) - 1)

*-- If remainder is longer than location of " " + 1
lc_field = LTRIM(IIF(LEN(lc_field) AT(" ", lc_field) + 1, ;
SUBSTR(lc_field, AT(" ", lc_field) + 1 ), ""))

ELSE
*-- Setup first and only word
lc_fld1 = lc_field
lc_field = ""
ENDIF

*-- If not at end of string
IF LEN(lc_field) 0

*-- If more than one word left in string
IF " " $ lc_field
*-- Setup second word
lc_fld2 = LEFT(lc_field, AT(" ", lc_field) - 1)

*-- If remainder is longer than location of " " + 1
lc_field = LTRIM(IIF(LEN(lc_field) AT(" ", lc_field) + 1, ;
SUBSTR(lc_field, AT(" ", lc_field) + 1 ), ""))

ELSE
*-- Setup second and last word
lc_fld2 = lc_field
lc_field = ""
ENDIF

*-- If not at end of string
IF LEN(lc_field) 0

*-- If more than one word left in string
IF " " $ lc_field
*-- Setup third word
lc_fld3 = LEFT(lc_field, AT(" ", lc_field) - 1)

*-- If remainder is longer than location of " " + 1
lc_field = LTRIM(IIF(LEN(lc_field) AT(" ", lc_field) + 1, ;
SUBSTR(lc_field, AT(" ", lc_field) + 1 ), ""))

ELSE
*-- Setup third and last word
lc_fld3 = lc_field
lc_field = ""
ENDIF

ENDIF && LEN(lc_field) 0

ENDIF && LEN(lc_field) 0

ENDIF && LEN(lc_field) 0

*-- Develop three piece soundex key expression
lc_sndxpr = SOUNDEX(lc_fld1) + SOUNDEX(lc_fld2) + SOUNDEX(lc_fld3)

*-- Return key expression
RETURN lc_sndxpr
Nov 27 '07 #1
2 3335
Hi Cj,

From your description, you're encountering some problem when try dealing
with a VPF database in ADO.NET/VB.NET code, correct?

As for the VFP database, have you ever used through .net ADO.NET before and
in what kind of project are you currently using it(winform or web )?

Since I'm not quite familiar with VFP, I think we'd better first isolate
the issue to a typical function. If we can repro it through a simplified
one, that'll help much for continuous troubleshooting.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>Date: Tue, 27 Nov 2007 10:47:31 -0500
From: cj <cj@nospam.nospam>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
Subject: using foxpro table from VB.net 2005 with oledb
>We have a legacy accounting system (not developed in house) here that
happens to be written in Visual FoxPro. One of the tables has an index
that is actually a coded function COMPANY1 &&"G_RETSDX(COMPANY)".
When I try to use this table in VFP I get an error message "File
'g_retsdx.prg' does not exist." I click ok and continue on. We've
developed many VFP programs outside the accounting system that use this
table and we have to include the function g_retsdx in each of them so
this index will be set and this error will not occur.

Now I need to write a web service that will use this table using VB.net
2005. I set up the connection and commands but when I go to execute a
command, even fill a datatable, I get an exception that says, you
guessed it, "File 'g_retsdx.prg' does not exist." How do I get around
this?
>
I'm sure I could ignore the thrown exception but... I take it Oledb is
capable of reading the indexes of foxpro tables and would update those
indexes if a record was added or deleted. Since I'd be ignoring an
error on one of the many indexes in that CDX I would think it would
corrupt the CDX if I added or deleted a record. And I can't have that
happen.

I'm cross posting this in foxpro and vb.net and I really could use some
advice.

Thanks.

P.S. This is what the VFP foxpro function g_retsdx.prg is:
FUNCTION g_retsdx
PARAMETERS lc_field

*-- Trace call and assertion test removed to permit out of system USE

*-- Declare local variables private
PRIVATE lc_fld1, ;
lc_fld2, ;
lc_fld3, ;
lc_sndxpr

*-- Initialize values for three pieces of lc_field
lc_fld1 = ""
lc_fld2 = ""
lc_fld3 = ""

*-- Remove leading blanks
lc_field = LTRIM(lc_field)

*-- Define the three pieces prior to SOUNDEX conversion
IF LEN(lc_field) 0

*-- If more than one word in string
IF " " $ lc_field
*-- Setup first word
lc_fld1 = LEFT(lc_field, AT(" ", lc_field) - 1)

*-- If remainder is longer than location of " " + 1
lc_field = LTRIM(IIF(LEN(lc_field) AT(" ", lc_field) + 1, ;
SUBSTR(lc_field, AT(" ", lc_field) + 1 ), ""))

ELSE
*-- Setup first and only word
lc_fld1 = lc_field
lc_field = ""
ENDIF

*-- If not at end of string
IF LEN(lc_field) 0

*-- If more than one word left in string
IF " " $ lc_field
*-- Setup second word
lc_fld2 = LEFT(lc_field, AT(" ", lc_field) - 1)

*-- If remainder is longer than location of " " + 1
lc_field = LTRIM(IIF(LEN(lc_field) AT(" ", lc_field) + 1, ;
SUBSTR(lc_field, AT(" ", lc_field) + 1 ), ""))

ELSE
*-- Setup second and last word
lc_fld2 = lc_field
lc_field = ""
ENDIF

*-- If not at end of string
IF LEN(lc_field) 0

*-- If more than one word left in string
IF " " $ lc_field
*-- Setup third word
lc_fld3 = LEFT(lc_field, AT(" ", lc_field) - 1)

*-- If remainder is longer than location of " " + 1
lc_field = LTRIM(IIF(LEN(lc_field) AT(" ", lc_field) + 1, ;
SUBSTR(lc_field, AT(" ", lc_field) + 1 ), ""))

ELSE
*-- Setup third and last word
lc_fld3 = lc_field
lc_field = ""
ENDIF

ENDIF && LEN(lc_field) 0

ENDIF && LEN(lc_field) 0

ENDIF && LEN(lc_field) 0

*-- Develop three piece soundex key expression
lc_sndxpr = SOUNDEX(lc_fld1) + SOUNDEX(lc_fld2) + SOUNDEX(lc_fld3)

*-- Return key expression
RETURN lc_sndxpr
Nov 28 '07 #2
cj
Steven, unfortunately this problem could probably only be answered by
someone who knows VFP. I did succeed in finding such a person on
another forum. I appreciate your attempt to help. Thanks.
Steven Cheng[MSFT] wrote:
Hi Cj,

From your description, you're encountering some problem when try dealing
with a VPF database in ADO.NET/VB.NET code, correct?

As for the VFP database, have you ever used through .net ADO.NET before and
in what kind of project are you currently using it(winform or web )?

Since I'm not quite familiar with VFP, I think we'd better first isolate
the issue to a typical function. If we can repro it through a simplified
one, that'll help much for continuous troubleshooting.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>Date: Tue, 27 Nov 2007 10:47:31 -0500
From: cj <cj@nospam.nospam>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
Subject: using foxpro table from VB.net 2005 with oledb
>We have a legacy accounting system (not developed in house) here that
happens to be written in Visual FoxPro. One of the tables has an index
that is actually a coded function COMPANY1 &&"G_RETSDX(COMPANY)".
When I try to use this table in VFP I get an error message "File
'g_retsdx.prg' does not exist." I click ok and continue on. We've
developed many VFP programs outside the accounting system that use this
table and we have to include the function g_retsdx in each of them so
this index will be set and this error will not occur.

Now I need to write a web service that will use this table using VB.net
2005. I set up the connection and commands but when I go to execute a
command, even fill a datatable, I get an exception that says, you
guessed it, "File 'g_retsdx.prg' does not exist." How do I get around
this?
>I'm sure I could ignore the thrown exception but... I take it Oledb is
capable of reading the indexes of foxpro tables and would update those
indexes if a record was added or deleted. Since I'd be ignoring an
error on one of the many indexes in that CDX I would think it would
corrupt the CDX if I added or deleted a record. And I can't have that
happen.

I'm cross posting this in foxpro and vb.net and I really could use some
advice.

Thanks.

P.S. This is what the VFP foxpro function g_retsdx.prg is:
FUNCTION g_retsdx
PARAMETERS lc_field

*-- Trace call and assertion test removed to permit out of system USE

*-- Declare local variables private
PRIVATE lc_fld1, ;
lc_fld2, ;
lc_fld3, ;
lc_sndxpr

*-- Initialize values for three pieces of lc_field
lc_fld1 = ""
lc_fld2 = ""
lc_fld3 = ""

*-- Remove leading blanks
lc_field = LTRIM(lc_field)

*-- Define the three pieces prior to SOUNDEX conversion
IF LEN(lc_field) 0

*-- If more than one word in string
IF " " $ lc_field
*-- Setup first word
lc_fld1 = LEFT(lc_field, AT(" ", lc_field) - 1)

*-- If remainder is longer than location of " " + 1
lc_field = LTRIM(IIF(LEN(lc_field) AT(" ", lc_field) + 1, ;
SUBSTR(lc_field, AT(" ", lc_field) + 1 ), ""))

ELSE
*-- Setup first and only word
lc_fld1 = lc_field
lc_field = ""
ENDIF

*-- If not at end of string
IF LEN(lc_field) 0

*-- If more than one word left in string
IF " " $ lc_field
*-- Setup second word
lc_fld2 = LEFT(lc_field, AT(" ", lc_field) - 1)

*-- If remainder is longer than location of " " + 1
lc_field = LTRIM(IIF(LEN(lc_field) AT(" ", lc_field) + 1, ;
SUBSTR(lc_field, AT(" ", lc_field) + 1 ), ""))

ELSE
*-- Setup second and last word
lc_fld2 = lc_field
lc_field = ""
ENDIF

*-- If not at end of string
IF LEN(lc_field) 0

*-- If more than one word left in string
IF " " $ lc_field
*-- Setup third word
lc_fld3 = LEFT(lc_field, AT(" ", lc_field) - 1)

*-- If remainder is longer than location of " " + 1
lc_field = LTRIM(IIF(LEN(lc_field) AT(" ", lc_field) + 1, ;
SUBSTR(lc_field, AT(" ", lc_field) + 1 ), ""))

ELSE
*-- Setup third and last word
lc_fld3 = lc_field
lc_field = ""
ENDIF

ENDIF && LEN(lc_field) 0

ENDIF && LEN(lc_field) 0

ENDIF && LEN(lc_field) 0

*-- Develop three piece soundex key expression
lc_sndxpr = SOUNDEX(lc_fld1) + SOUNDEX(lc_fld2) + SOUNDEX(lc_fld3)

*-- Return key expression
RETURN lc_sndxpr
Nov 29 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Steve Perry | last post by:
Hi, I have a large FoxPro table with an index that I need to be Queried from SQL Server by OLE.DB or ODBC. If I query the DBF directly a search takes 1 Minute +. Is there a way I can call the...
2
by: kungfukittens | last post by:
Hi, question how do you insert from VB.net to a foxpro date field eg insert into temp values('07/31/05', 2) i keep getting a type mismatch error on the date field temp table date date no ...
2
by: eric | last post by:
Hi Does any one know how to retrive data from foxpro 2.6 memo field in c#. I just manage to retrive the first row. /Eric
6
by: androoo | last post by:
I have a source database which stores the main image. I read the image out as this : Dim strSQL As String Dim objData As clsDatabase Dim dr As OleDb.OleDbDataReader strSQL += "select * from...
2
by: Sajid | last post by:
Hi! Bill, Actually I am using the following code to pack my FoxPro tables (Not Visual FoxPro tables). You know when you delete records from FoxPro they are just marked for deletion and don't get...
3
by: Amar | last post by:
I have a abc.PRG file in visual foxpro 8.0. I can run this file using visual foxpro environment and it creates a table X.dbf in the same folder where this program file is and populates some data in...
4
by: Robert Hooker | last post by:
I have installed our .NET application on a system running Microsoft Windows Vista operating system. When I run our application, I receive the following error message whenever it tries to create...
0
by: smtwtfs007 | last post by:
I have an ASP.NET website. I'm trying to connect to a Foxpro database (ADO.NET) with the following connect string: txtConnectionStr.Text = "\\soya4042\Qd\LM\LMS\Data" Dim strFoxProDirectory As...
1
by: smtwtfs007 | last post by:
I have an ASP.NET website. I'm trying to connect to a Foxpro database (ADO.NET) with the following connect string: txtConnectionStr.Text = "\\soya4042\Qd\LM\LMS\Data" Dim strFoxProDirectory As...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.