473,569 Members | 2,400 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(COM PANY)".
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(l c_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(l c_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(l c_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 3364
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.nosp am>
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(COM PANY)".
When I try to use this table in VFP I get an error message "File
'g_retsdx.pr g' 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(l c_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(l c_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(l c_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.nosp am>
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(COM PANY)".
When I try to use this table in VFP I get an error message "File
'g_retsdx.pr g' 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(l c_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(l c_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(l c_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
2301
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 data from the table and use the existing FoxPro Index? Thanks Steve
2
6359
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 integer :confused: --
2
3904
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
4916
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 picstable" ' this is a foxpro database 'open object for database work objData = objData.GetInstance
2
2614
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 permanently deleted unless you issue pack command in FoxPro. So I am using the following snippet to achieve that. Now the problem is that...
3
9860
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 the table. I want a way to run this abc.PRG file through VB.net environment. (Equivalent method to perform same as "DO abc.prg" command in foxpro)....
4
8442
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 a DBF file using VFPODBC: "ERROR Driver does not support this function" I am using a connection string that I have used for many years with no...
0
1117
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 String = txtConnectionStr.Text Dim strConnection As String = "User ID=;DSN=;Cache Authentication=False;Data Source='" & _ Trim(strFoxProDirectory)...
1
1847
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 String = txtConnectionStr.Text Dim strConnection As String = "User ID=;DSN=;Cache Authentication=False;Data Source='" & _ Trim(strFoxProDirectory)...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
946
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.