I'm using a postgreSQL backend and vb.net front end. I'm using Visual Studio 2005 to develop the vb.net front end which connects via odbc to PostgreSQL.

I am having trouble with functions in postgreSQL. I am trying to make a table function which returns all records in a table which match the input variable.

For example:
Code:
CREATE OR REPLACE FUNCTION tablefunction(bpchar)
  RETURNS SETOF inventory AS
    SELECT * FROM inventory WHERE inventoryid = $1;
  LANGUAGE 'sql' VOLATILE;
Now, the inventoryid is a varchar type. Now this works, but when i run:

Code:
select * from tablefunction('INV89')
It returns all results in a single field.

Some questions:

1) How do I make each field value get put into a separate field, just like a view?

2) When I import into visual studio the function as a datasource, how do I pass the input parameter to it?

Thanks in advance.