[fdo-users] .NET FeatureReader and MySQL FDO provider

George McLean gmclean at gorge.net
Sat Jan 13 19:58:42 EST 2007


Hello,

I have written an application in .NET that queries a database using an 
FDO provider. The application works well when I use the 
Autodesk.SqlServer3.1 provider but does some strange things when I use 
the OSGeo.MySQL.3.1 provider or the OSGeo.MySQL.3.2 driver.

Specifically, I am having trouble with the GetString method in a 
FeatureReader object. When I query data from MySql and loop through the 
data set, the GetString method does not appear to clear out the values 
from the previous record for the given field. If I have two records with 
values of 'ABCDEF' and 'XYZ', the first pass through the loop will set 
the value of strValue to 'ABCDEF' but the second pass yields 'XYZDEF'. 
It looks like some sort of buffer is not getting cleared and I am 
guessing it is in the MySQL provider. This code works correctly with SQL 
Server. Any suggestions?

       Dim DataReader As Autodesk.Gis.Fdo.Commands.Feature.IFeatureReader
      .................
           DataReader = FdoSelectCmd.Execute()
           While DataReader.ReadNext() = True
                   strValue = ""
                   If DataReader.IsNull("a_text_field") Then
                       strValue = "none"
                   Else
                       strValue = DataReader.GetString("a_text_field")
                   End If
         End While

Thanks

George McLean



More information about the fdo-users mailing list