From: | Rob Sargent <robjsargent(at)gmail(dot)com> |
---|---|
To: | Łukasz Jarych <jaryszek(at)gmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Run Stored procedure - function from VBA |
Date: | 2018-06-18 23:34:04 |
Message-ID: | 0FB3637B-95EC-453A-8458-5A1ED525850E@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> On Jun 18, 2018, at 9:47 AM, Łukasz Jarych <jaryszek(at)gmail(dot)com> wrote:
>
> Hi Guys,
>
> i have example function :
>
> CREATE OR REPLACE FUNCTION totalRecords ()
> RETURNS integer AS $total$
> declare
> total integer;
> BEGIN
> SELECT count(*) into total FROM COMPANY;
> RETURN total;
> END;
> $total$ LANGUAGE plpgsql;
>
> and i want to run it from VBA using odbc connection.
>
> What is the best way to use it ?
>
> something like this:
>
> Dim dbCon as new ADODB.Connection
> Dim rst as new ADODB.Recordset
>
> Dbcon.connectionstring=”Your connection string goes here!”
> Dbcon.open
>
> Rst.open strsql
> where strsql is "Select * from totalRecords" or this is not a good solution?
>
> Best,
> Jacek
You need the parentheses after the function name: “select * from totalrecords();"
From | Date | Subject | |
---|---|---|---|
Next Message | Sherrylyn Branchaw | 2018-06-18 23:50:04 | Re: What to do when dynamic shared memory control segment is corrupt |
Previous Message | Rob Sargent | 2018-06-18 23:33:03 | Re: Run Stored procedure - function from VBA |