That's pretty confused C code. The most obvious problem is that you're not calling the Pqntuples function; you're just examining the value of a variable called ntuples, when you haven't set that value after calling Pqexec (and maybe have never set it). Take it step by step, and check error returns at each step--including connecting to the database, and of course especially check errors after calling PQexec--first checking that pgr is not null, then if not null using the PQresultStatus, PQresStatus, PQresultErroMessage functions, otherwise the PQstatus, PQerrorMessage functions. Then if you still have problems, post more complete code that includes important things like connecting to the database, and declarations & assignments to key variables. Also, what is this "(function)(args)" stuff? Normally, the PQ functions are plain C functions, called as "function(args)". Do you really have some setup where you have function pointer variables and your compiler requires that outdated syntax? Or is this more basic C confusion? -- Scott Ribe scott_ribe@xxxxxxxxxxxxxxx http://www.killerbytes.com/ (303) 722-0567 voice -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general