Handling Trailing Spaces with VFP Data and ADO.NET
When working with Visual FoxPro data in ADO.NET, you may be surprised to see trailing spaces at the end of your character data. Visual FoxPro automatically trims these trailing spaces in BROWSE windows and when binding to user interface controls, but .NET does not.
To address this issue, you can change your character fields to varchar fields (introduced in VFP 9.0). You can then write a quick utility to remove the trailing spaces from the character data.
If you can't remove the extra spaces due to requirements in your Visual FoxPro applications that are accessing the same data, you can remove the spaces programmatically in your .NET applications by adding RTRIM() commands to your ADO.NET SELECT statements. For example:
SELECT employeeid, lastname, RTRIM(firstname) as FirstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalcode, country, homephone, extension, photo, notes, reportsto FROM Employees
Chief Architect MM .NET Application Framework