Solving PostgreSQL problems with Visual Basic
Today I had the chance of solving a recurring problem we've been having over here. When trying to add new records to an empty table using ADO (the .Open and .AddNew sentences of the Recordset object), PostgreSQL's ODBC driver complains with an "Row value out of range" error. The solution is pretty simple. Instead of opening the Recordset using adOpenDynamic or adOpenKeyset, I just open it using adOpenForwardOnly. That way I avoid the SELECT statement the ODBC driver automatically does, which is truly what causes the error on update. Naturally, this solution won't let me use the recordset to retrieve data, and so I either have to decide the values of the primary keys in advance (easy, because the recordset is supposed to be empty), or open another recordset first, to count and read the data in the tables (which is empty).