Hello. We have this simple stored procedure to retrieve the server's time:
CREATE PROCEDURE [GetCurrentDateTime]
AS
SELECT GETDATE() AS CurrentDateTime
GO
Then in code we do this:
DateTime dt = (DateTime)RetrievalProcedures.GetCurrentDateTime().Rows[0][0];
This works fine, but in production we (rarely) get this exception:
System.InvalidCastException: Specified cast is not valid.
or this one:
System.IndexOutOfRangeException: There is no row at position 0.
at System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex)
at System.Data.DataRowCollection.get_Item(Int32 index)
Any ideas? (We use LLBL v1.0.2005.1, SelfServicing and SQL2000/2005).