Anton_

My .NET 2.0 app is querying WDS and fetching data in following way.

String sqlQueryString = "SELECT System.ItemDate FROM SYSTEMINDEX..SCOPE()";

using (OleDbCommand queryCommand = new OleDbCommand(sqlQueryString, connection))

{

OleDbDataReader reader = queryCommand.ExecuteReader();

while (reader.Read())

{

//Do data processing

Console.WriteLine(reader.GetValue[0]);

}

}

Sometimes this code produces following System.InvalidCastException exceptions. It seems to me that this is a bug in WDS database. Rebuilding WDS index solves this problem but it's quite time consuming.

This problem appears with WDS 3.01 on Server 2003 SP1 and XP SP2.

Could someone told me how to solve this problem

System.InvalidCastException: The data value could not be converted for reasons other than sign mismatch or data overflow. For example, the data was corrupted in the data store but the row was still retrievable.
at System.Data.OleDb.ColumnBinding.Value()
at System.Data.OleDb.OleDbDataReader.GetValues(Object[] values)
at System.Data.Common.DbEnumerator.MoveNext()

at MyFunction

System.InvalidCastException: The data value could not be converted for reasons other than sign mismatch or data overflow. For example, the data was corrupted in the data store but the row was still retrievable.

at System.Data.OleDb.ColumnBinding.Value()

at System.Data.OleDb.OleDbDataReader.GetValue(Int32 ordinal)

at MyFunction