Page 1 of 1

Index out of Range ???

Posted: Fri 24 Feb 2006 10:02
by AlexanderPriem
Hello,

I bought a site license for PostgreSQLDirect.NET. I am using the latest 2.40 version.

I am experiencing some problems now and then. Most ofthe time, everything is fine. But intermittently, queries exectued through PostgreSQLDirect.NET give an error message like "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index".

I searched about this error on the internet and found some documentation about it on the MSDN site. It seems that .NET 1.1 framework can give this error when the ADO.NET provider does not support the "SQLGetInfo" function.

Can you hel me with this error?

Again, it does not happen all the time. It happens sometimes, and not always with the same queries. Very weird...

Thanks in advance.

Posted: Fri 24 Feb 2006 14:03
by SecureGen
Description of this issue in MSDN says that it is related to ADO.NET data providers that use ODBC driver. Our PostgreSQLDirect .NET Data Provider does not use ODBC in any way. The SQLGetInfo function should be implemented in ODBC interface and it is not necessary for our provider.
In order to fix this issue please make sure that you set PgSqlCommand.ParameterCheck property to true.

Index out of Range ???

Posted: Fri 24 Feb 2006 14:20
by AlexanderPriem
Thanks for your reply. However, it does not solve my problem.

The code is am using is below :

function TCICT_PGSQL.Select(strSQL: string): string;
var
objCommand: PgsqlCommand;
begin
try
objCommand := PgsqlCommand.Create(strSQL,objConn);
if InTransaction then objCommand.Transaction := objTransaction;
objCommand.ParameterCheck := True;
objDataReader := objCommand.ExecuteReader();
result := strSQL;
if blnDebugMode then objEventLog.WriteEntry('UID '+intUserID.ToString+
' : '+strSQL,EventLogEntryType.Information,111);
except
on E: Exception do begin
objEventLog.WriteEntry('UID '+intUserID.ToString+
' : '+strSQL+' -> ['+E.Message+']',EventLogEntryType.Error,10111);
raise;
end;
end;
end;

The query we are doing is a very simple query. It is also not the same query that is failing. The query that fails differs every time 

Do you have any more suggestions ?

Sometime the index is out of Range

Posted: Fri 24 Feb 2006 14:30
by T.Winkler
Yes I know this problem also. The only reason I have is to close the program, restart and the same query with the same data will be work fine.
I have this problem with VS2003 Framwork 1.1 and also with VS2005 Framwork 2.

Is there a rease to solve this problem?

Index out of Range ???

Posted: Fri 24 Feb 2006 16:31
by AlexanderPriem
Really weird, this problem.

The point is that the SAME SELECT QUERY (not even an insert/update, but a simple SELECT) will succeed one time, but fail the other...

I do have to mention that the application in which it fails most often is a situation where thousands of SELECTS are used in a loop. So it is pushing the database a bit, I guess.

However, using plain ODBC this is no problem, using the pgsqlDirect.NET component I am experiencing problems.

I really hope you can help with this....

Index out of Range ???

Posted: Sun 26 Feb 2006 15:14
by AlexanderPriem
I have doe some more research this weekend into this problem. I still have not been able to solve it.

I checked the PostgreSQL (8.1.3) logfile and everytime i got the weird error message from PostgreSQLDirect.NET, there was an error message in the PostgreSQL logfile, saying "unexpected EOF on client connection".

So it seems the client side drops the connection unexpectedly???

I hope this helps and I hope that I can look forward to some more clues or a software fix from you :)

Index out of Range

Posted: Wed 01 Mar 2006 09:32
by SecureGen
This problem should not appear if you call PgSqlCommand.Dispose() method after the command is no longer needed. We have fixed the problem. The fix will be available in the next build of PostgreSQLDirect .NET. Watch for announcements in the forum.