pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Executing SP in VB6
8+ messages / 5 participants
[nested] [flat]

* Executing SP in VB6
@ 2004-10-04 19:13 Sandro Yaqub Yusuf <sandro@proservvi.com.br>
  0 siblings, 0 replies; 8+ messages in thread

From: Sandro Yaqub Yusuf @ 2004-10-04 19:13 UTC (permalink / raw)
  To: pgsql-odbc

Hello,

Please, I just trying search in all WEB SITES about using STORED PROCEDURES with VISUAL BASIC, but I not found anything about this that can help me.

I have a table: USERS with colums IDUSER, USER, PASSWORD, FULLNAME
I need get the colum FULLNAME with parameter USER.
How I do to create and execute a STORED PROCEDURE in VISUAL BASIC 6 to resolve this litle problem ? (please, forgiven my english because I living in BRAZIL and not speak english).

Thanks,

Sandroyy

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Executing SP in VB6
@ 2004-10-04 19:15 Goulet, Dick <DGoulet@vicr.com>
  2004-10-04 19:24 ` Re: Executing SP in VB6 Sandro Yaqub Yusuf <sandro@proservvi.com.br>
  0 siblings, 1 reply; 8+ messages in thread

From: Goulet, Dick @ 2004-10-04 19:15 UTC (permalink / raw)
  To: Sandro Yaqub Yusuf <sandro@proservvi.com.br>; pgsql-odbc

May I ask why you want to use a stored procedure?  A simple "Select
fullname from users where user = '<value>';" should work just fine.
 

Dick Goulet
Senior Oracle DBA
Oracle Certified 8i DBA 

 

  _____  

From: Sandro Yaqub Yusuf [mailto:sandro@proservvi.com.br] 
Sent: Monday, October 04, 2004 3:13 PM
To: pgsql-odbc@postgresql.org
Subject: [ODBC] Executing SP in VB6


Hello,
 
Please, I just trying search in all WEB SITES about using STORED
PROCEDURES with VISUAL BASIC, but I not found anything about this that
can help me.
 
I have a table: USERS with colums IDUSER, USER, PASSWORD, FULLNAME
I need get the colum FULLNAME with parameter USER.
How I do to create and execute a STORED PROCEDURE in VISUAL BASIC 6 to
resolve this litle problem ? (please, forgiven my english because I
living in BRAZIL and not speak english).
 
Thanks,
 
Sandroyy
 
 

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Executing SP in VB6
  2004-10-04 19:15 Re: Executing SP in VB6 Goulet, Dick <DGoulet@vicr.com>
@ 2004-10-04 19:24 ` Sandro Yaqub Yusuf <sandro@proservvi.com.br>
  2004-10-04 21:52   ` Re: Executing SP in VB6 Sandro Yaqub Yusuf <sandro@proservvi.com.br>
  2004-10-05 01:31   ` Re: Executing SP in VB6 Iain <iain@mst.co.jp>
  2004-10-05 02:07   ` Re: Executing SP in VB6 Iain <iain@mst.co.jp>
  0 siblings, 3 replies; 8+ messages in thread

From: Sandro Yaqub Yusuf @ 2004-10-04 19:24 UTC (permalink / raw)
  To: Goulet, Dick <DGoulet@vicr.com>; +Cc: pgsql-odbc

Hello my friend,

That is simple. I work developing programs in Visual Basic using complex Stored Procedures in SQL-SERVER 7/2000.
I want to make STORED PROCEDURES in PostGresQL using Visual Basic 6. I need one example to begin.

Thanks,

Sandroyy
  ----- Original Message ----- 
  From: Goulet, Dick 
  To: Sandro Yaqub Yusuf ; pgsql-odbc@postgresql.org 
  Sent: Monday, October 04, 2004 4:15 PM
  Subject: RE: [ODBC] Executing SP in VB6


  May I ask why you want to use a stored procedure?  A simple "Select fullname from users where user = '<value>';" should work just fine.

  Dick Goulet
  Senior Oracle DBA
  Oracle Certified 8i DBA 





------------------------------------------------------------------------------
  From: Sandro Yaqub Yusuf [mailto:sandro@proservvi.com.br] 
  Sent: Monday, October 04, 2004 3:13 PM
  To: pgsql-odbc@postgresql.org
  Subject: [ODBC] Executing SP in VB6


  Hello,

  Please, I just trying search in all WEB SITES about using STORED PROCEDURES with VISUAL BASIC, but I not found anything about this that can help me.

  I have a table: USERS with colums IDUSER, USER, PASSWORD, FULLNAME
  I need get the colum FULLNAME with parameter USER.
  How I do to create and execute a STORED PROCEDURE in VISUAL BASIC 6 to resolve this litle problem ? (please, forgiven my english because I living in BRAZIL and not speak english).

  Thanks,

  Sandroyy

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Executing SP in VB6
  2004-10-04 19:15 Re: Executing SP in VB6 Goulet, Dick <DGoulet@vicr.com>
  2004-10-04 19:24 ` Re: Executing SP in VB6 Sandro Yaqub Yusuf <sandro@proservvi.com.br>
@ 2004-10-04 21:52   ` Sandro Yaqub Yusuf <sandro@proservvi.com.br>
  2 siblings, 0 replies; 8+ messages in thread

From: Sandro Yaqub Yusuf @ 2004-10-04 21:52 UTC (permalink / raw)
  To: Rick Sivernell <res005ru@verizon.net>; +Cc: pgsql-odbc

Hello my friend,

I know.
I have worked with VB about 6 years. I´m using ACCESS, ORACLE, SQL_SERVER, 
XBASE integrated with Visual Basic.
Now, for my experience, I would like to use PostGresQL with VB6. OK ??!!

Thanks for you colaboration.

Sandroyy


----- Original Message ----- 
From: "Rick Sivernell" <res005ru@verizon.net>
To: "Sandro Yaqub Yusuf" <sandro@proservvi.com.br>
Sent: Monday, October 04, 2004 1:07 PM
Subject: Re: [ODBC] Executing SP in VB6


> On Mon, 4 Oct 2004 16:24:33 -0300
> "Sandro Yaqub Yusuf" <sandro@proservvi.com.br> wrote:
>
>> Hello my friend,
>>
>> That is simple. I work developing programs in Visual Basic using complex 
>> Stored
>> Procedures in SQL-SERVER 7/2000. I want to make STORED PROCEDURES in 
>> PostGresQL
>> using Visual Basic 6. I need one example to begin.
>>
>> Thanks,
>>
>> Sandroyy
>>   ----- Original Message ----- 
>>   From: Goulet, Dick
>>   To: Sandro Yaqub Yusuf ; pgsql-odbc@postgresql.org
>>   Sent: Monday, October 04, 2004 4:15 PM
>>   Subject: RE: [ODBC] Executing SP in VB6
>>
>>
>>   May I ask why you want to use a stored procedure?  A simple "Select 
>> fullname from
>>   users where user = '<value>';" should work just fine.
>>
>>   Dick Goulet
>>   Senior Oracle DBA
>>   Oracle Certified 8i DBA
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>>   From: Sandro Yaqub Yusuf [mailto:sandro@proservvi.com.br]
>>   Sent: Monday, October 04, 2004 3:13 PM
>>   To: pgsql-odbc@postgresql.org
>>   Subject: [ODBC] Executing SP in VB6
>>
>>
>>   Hello,
>>
>>    Please, I just trying search in all WEB SITES about using STORED 
>> PROCEDURES with
>>   VISUAL BASIC, but I not found anything about this that can help me.
>>
>>   I have a table: USERS with colums IDUSER, USER, PASSWORD, FULLNAME
>>   I need get the colum FULLNAME with parameter USER.
>>   How I do to create and execute a STORED PROCEDURE in VISUAL BASIC 6 to 
>> resolve
>>   this litle problem ? (please, forgiven my english because I live in 
>> BRAZIL and
>>   not speak english).
>>
>>   Thanks,
>>
>>   Sandroyy
>>
>>
> Sandro
>
>   You do not need to use stored procedure, VB has database objects for you 
> to use.
> Personally I would use C++ and OLE DB. It is much better, faster and if 
> you are
> working across OSes, you still connect to db using odbc. From your 
> description your
> are on M$. ODBC or OLE DB do not care what the database is, as long as 
> there is a ODBC
> driver. There are plenty of examples in books and on the net.
>
> cheers
>
> -- 
> Rick Sivernell
> Dallas, Texas  75287
> 972 306-2296
> res005ru@verizon.net
> Gentoo Linux
> Registered Linux User #193859
>
>   .~.
>  / v \
> /( _ )\
>   ^ ^
> In Linux we trust! 




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Executing SP in VB6
  2004-10-04 19:15 Re: Executing SP in VB6 Goulet, Dick <DGoulet@vicr.com>
  2004-10-04 19:24 ` Re: Executing SP in VB6 Sandro Yaqub Yusuf <sandro@proservvi.com.br>
@ 2004-10-05 01:31   ` Iain <iain@mst.co.jp>
  2 siblings, 0 replies; 8+ messages in thread

From: Iain @ 2004-10-05 01:31 UTC (permalink / raw)
  To: Sandro Yaqub Yusuf <sandro@proservvi.com.br>; +Cc: pgsql-odbc

I've never done it either, but I have some code (which incidentally I got 
from asktom.oracle.com) that you may be able to adapt. The original code 
uses a simple select and bind variables. Because it uses binds it should be 
easy to adapt to a SP's parameters:

Sub ParameterExample()

   Dim cmd As New ADODB.Command

   Dim rs As New ADODB.Recordset

   Dim prm As ADODB.Parameter



   cmd.ActiveConnection = Provider=OraOLEDB.Oracle;User 
ID=scott;Password=tiger;Data Source=oraDSN;

   ' Set the command's text, and specify that it is an SQL statement.

   cmd.CommandText = "SELECT item_name FROM v_syouhin_info WHERE deptno = ?"

   cmd.CommandType = adCmdText



   ' Set up a new parameter for the select.

   Set prm = cmd.CreateParameter("deptno", adInteger, adParamInput, , 10)

   cmd.Parameters.Append prm



   ' Create a recordset by executing the command.

   Set rs = cmd.Execute



   ' Loop through the recordset and print the first field.

   Do While Not rs.EOF

      Debug.Print rs(0)

      rs.MoveNext

   Loop



   ' Close the recordset.

   rs.Close



End Sub



    Modify it as follows to use a stored procedure:

Sub ParameterExample()

   Dim cmd As New ADODB.Command

   Dim rs As New ADODB.Recordset

   Dim prm As ADODB.Parameter



   cmd.ActiveConnection = Provider=OraOLEDB.Oracle;User 
ID=scott;Password=tiger;Data Source=oraDSN;

   ' Set the command's text, and specify that it is an SQL statement.

   cmd.CommandText = "STORED_PROCEDURE_NAME"    ' <-- changed

   cmd.CommandType = adCmdStoredProc     ' <-- changed this part too



   ' Set up a new parameter for the select.

   Set prm = cmd.CreateParameter("deptno", adInteger, adParamInput, , 10)

   cmd.Parameters.Append prm



   ' Create a recordset by executing the command.

   Set rs = cmd.Execute



   ' Loop through the recordset and print the first field.

   Do While Not rs.EOF

      Debug.Print rs(0)

      rs.MoveNext

   Loop



   ' Close the recordset.

   rs.Close



End Sub


In the second case the stored procedure has one in parameter which is deptno 
and the out parameter (or possibly the function return) is a result set.

As I said, I havn't tried it myself, so I'd be interested to know if you get 
it working on PG.

Regards
Iain


  ----- Original Message ----- 
  From: Sandro Yaqub Yusuf
  To: Goulet, Dick
  Cc: pgsql-odbc@postgresql.org
  Sent: Tuesday, October 05, 2004 4:24 AM
  Subject: Re: [ODBC] Executing SP in VB6


  Hello my friend,

  That is simple. I work developing programs in Visual Basic using complex 
Stored Procedures in SQL-SERVER 7/2000.
  I want to make STORED PROCEDURES in PostGresQL using Visual Basic 6. I 
need one example to begin.

  Thanks,

  Sandroyy
    ----- Original Message ----- 
    From: Goulet, Dick
    To: Sandro Yaqub Yusuf ; pgsql-odbc@postgresql.org
    Sent: Monday, October 04, 2004 4:15 PM
    Subject: RE: [ODBC] Executing SP in VB6


    May I ask why you want to use a stored procedure?  A simple "Select 
fullname from users where user = '<value>';" should work just fine.

    Dick Goulet
    Senior Oracle DBA
    Oracle Certified 8i DBA





----------------------------------------------------------------------------
    From: Sandro Yaqub Yusuf [mailto:sandro@proservvi.com.br]
    Sent: Monday, October 04, 2004 3:13 PM
    To: pgsql-odbc@postgresql.org
    Subject: [ODBC] Executing SP in VB6


    Hello,

    Please, I just trying search in all WEB SITES about using STORED 
PROCEDURES with VISUAL BASIC, but I not found anything about this that can 
help me.

    I have a table: USERS with colums IDUSER, USER, PASSWORD, FULLNAME
    I need get the colum FULLNAME with parameter USER.
    How I do to create and execute a STORED PROCEDURE in VISUAL BASIC 6 to 
resolve this litle problem ? (please, forgiven my english because I living 
in BRAZIL and not speak english).

    Thanks,

    Sandroyy

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Executing SP in VB6
  2004-10-04 19:15 Re: Executing SP in VB6 Goulet, Dick <DGoulet@vicr.com>
  2004-10-04 19:24 ` Re: Executing SP in VB6 Sandro Yaqub Yusuf <sandro@proservvi.com.br>
@ 2004-10-05 02:07   ` Iain <iain@mst.co.jp>
  2 siblings, 0 replies; 8+ messages in thread

From: Iain @ 2004-10-05 02:07 UTC (permalink / raw)
  To: Sandro Yaqub Yusuf <sandro@proservvi.com.br>; +Cc: pgsql-odbc

Hi Yusef,

I just realized that it probably isn't the VB code you wanted to see, but 
the pg stored procedure code.

I don't have an example on hand, but presumably all you have to do is return 
a ref cursor from you pg procedure and the same VB code that you used for 
sql server would work on pg. Maybe...

Anyway, I think that you should check the docs for "refcursor" - maybe 
section 37.8 and see if that is what you are looking for.

Regards
Iain
----- Original Message ----- 
From: Sandro Yaqub Yusuf
To: Goulet, Dick
Cc: pgsql-odbc@postgresql.org
Sent: Tuesday, October 05, 2004 4:24 AM
Subject: Re: [ODBC] Executing SP in VB6


Hello my friend,

That is simple. I work developing programs in Visual Basic using complex 
Stored Procedures in SQL-SERVER 7/2000.
I want to make STORED PROCEDURES in PostGresQL using Visual Basic 6. I need 
one example to begin.

Thanks,

Sandroyy
----- Original Message ----- 
From: Goulet, Dick
To: Sandro Yaqub Yusuf ; pgsql-odbc@postgresql.org
Sent: Monday, October 04, 2004 4:15 PM
Subject: RE: [ODBC] Executing SP in VB6


May I ask why you want to use a stored procedure?  A simple "Select fullname 
from users where user = '<value>';" should work just fine.

Dick Goulet
Senior Oracle DBA
Oracle Certified 8i DBA





From: Sandro Yaqub Yusuf [mailto:sandro@proservvi.com.br]
Sent: Monday, October 04, 2004 3:13 PM
To: pgsql-odbc@postgresql.org
Subject: [ODBC] Executing SP in VB6


Hello,

Please, I just trying search in all WEB SITES about using STORED PROCEDURES 
with VISUAL BASIC, but I not found anything about this that can help me.

I have a table: USERS with colums IDUSER, USER, PASSWORD, FULLNAME
I need get the colum FULLNAME with parameter USER.
How I do to create and execute a STORED PROCEDURE in VISUAL BASIC 6 to 
resolve this litle problem ? (please, forgiven my english because I living 
in BRAZIL and not speak english).

Thanks,

Sandroyy 




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Executing SP in VB6
@ 2004-10-04 23:29 Andrew Ayers <aayers@eldocomp.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Andrew Ayers @ 2004-10-04 23:29 UTC (permalink / raw)
  To: pgsql-odbc

Sandro Yaqub Yusuf wrote:
> Hello my friend,
> 
> I know.
> I have worked with VB about 6 years. I´m using ACCESS, ORACLE, 
> SQL_SERVER, XBASE integrated with Visual Basic.
> Now, for my experience, I would like to use PostGresQL with VB6. OK ??!!

Yes, it is possible to use PostgreSQL with VB6, via ODBC (I have posted 
numerous times in the past on this - see the archives if you are 
interested, I am not going to repeat myself here) - I am doing it as we 
speak. But I don't think this is what you are asking.

If I am understanding you correctly, you are wanting to code stored 
procedures in VB and load them into your PostgreSQL DB, correct? As far 
as I know, this is *not* possible. You can, however, write SP's using 
PL/PgSQL, which is similar to PL on Oracle, from what I understand.

Once you have your SP written, there should be a way to call/use it via 
ODBC. I have never done this, but I did find this post, which may give 
you some help:

http://archives.postgresql.org/pgsql-novice/2004-04/msg00050.php

Andrew Ayers

> ----- Original Message ----- From: "Rick Sivernell" <res005ru@verizon.net>
> To: "Sandro Yaqub Yusuf" <sandro@proservvi.com.br>
> Sent: Monday, October 04, 2004 1:07 PM
> Subject: Re: [ODBC] Executing SP in VB6
> 
> 
>> On Mon, 4 Oct 2004 16:24:33 -0300
>> "Sandro Yaqub Yusuf" <sandro@proservvi.com.br> wrote:
>>
>>> Hello my friend,
>>>
>>> That is simple. I work developing programs in Visual Basic using 
>>> complex Stored
>>> Procedures in SQL-SERVER 7/2000. I want to make STORED PROCEDURES in 
>>> PostGresQL
>>> using Visual Basic 6. I need one example to begin.
>>>
>>> Thanks,
>>>
>>> Sandroyy
>>>   ----- Original Message -----   From: Goulet, Dick
>>>   To: Sandro Yaqub Yusuf ; pgsql-odbc@postgresql.org
>>>   Sent: Monday, October 04, 2004 4:15 PM
>>>   Subject: RE: [ODBC] Executing SP in VB6
>>>
>>>
>>>   May I ask why you want to use a stored procedure?  A simple "Select 
>>> fullname from
>>>   users where user = '<value>';" should work just fine.
>>>
>>>   Dick Goulet
>>>   Senior Oracle DBA
>>>   Oracle Certified 8i DBA
>>>
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------ 
>>>
>>>   From: Sandro Yaqub Yusuf [mailto:sandro@proservvi.com.br]
>>>   Sent: Monday, October 04, 2004 3:13 PM
>>>   To: pgsql-odbc@postgresql.org
>>>   Subject: [ODBC] Executing SP in VB6
>>>
>>>
>>>   Hello,
>>>
>>>    Please, I just trying search in all WEB SITES about using STORED 
>>> PROCEDURES with
>>>   VISUAL BASIC, but I not found anything about this that can help me.
>>>
>>>   I have a table: USERS with colums IDUSER, USER, PASSWORD, FULLNAME
>>>   I need get the colum FULLNAME with parameter USER.
>>>   How I do to create and execute a STORED PROCEDURE in VISUAL BASIC 6 
>>> to resolve
>>>   this litle problem ? (please, forgiven my english because I live in 
>>> BRAZIL and
>>>   not speak english).
>>>
>>>   Thanks,
>>>
>>>   Sandroyy
>>>
>>>
>> Sandro
>>
>>   You do not need to use stored procedure, VB has database objects for 
>> you to use.
>> Personally I would use C++ and OLE DB. It is much better, faster and 
>> if you are
>> working across OSes, you still connect to db using odbc. From your 
>> description your
>> are on M$. ODBC or OLE DB do not care what the database is, as long as 
>> there is a ODBC
>> driver. There are plenty of examples in books and on the net.
>>
>> cheers
>>
>> -- 
>> Rick Sivernell
>> Dallas, Texas  75287
>> 972 306-2296
>> res005ru@verizon.net
>> Gentoo Linux
>> Registered Linux User #193859
>>
>>   .~.
>>  / v \
>> /( _ )\
>>   ^ ^
>> In Linux we trust! 
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
>               http://www.postgresql.org/docs/faqs/FAQ.html
> 
> 
> 


-- CONFIDENTIALITY NOTICE --

This message is intended for the sole use of the individual and entity to whom it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email, and delete the message. Thank you.



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Executing SP in VB6
@ 2004-10-05 06:45 Philippe Lang <philippe.lang@attiksystem.ch>
  0 siblings, 0 replies; 8+ messages in thread

From: Philippe Lang @ 2004-10-05 06:45 UTC (permalink / raw)
  To: Sandro Yaqub Yusuf <sandro@proservvi.com.br>; pgsql-odbc

Hello Sandro. Good idea to use stored procedures. I'm using MS Access, so I guess you may have to adapt the code a bit...

This code uses DAO, not ADO or whatever. I hope it will help you.

Here we are:

1) The stored procedure:
------------------------
CREATE FUNCTION public.search_your_tbl_name(varchar)
  RETURNS SETOF your_tbl_name AS
'
SELECT * FROM public.your_tbl_name
WHERE lower(id) LIKE lower($1)
OR lower(foo1) LIKE lower($1)
OR lower(foo2) LIKE lower($1)
OR lower(foo3) LIKE lower($1)
OR lower(foo4) LIKE lower($1)
ORDER BY foo2
LIMIT 50
'
  LANGUAGE 'sql' VOLATILE;

2) The VBA code:
----------------
Public Function global_dsn_name() As String
    global_dsn_name = "your_dns_name"
End Function

Sub query_run(query As String, p As String)
On Error GoTo query_runError

    Dim MyWorkspace As DAO.Workspace
    Dim MyConnection As DAO.Connection
    Dim MyRecordset As DAO.Recordset
    Dim MySQLString As String
    Dim MyODBCConnectString As String
    
    Set MyWorkspace = CreateWorkspace("ODBCWorkspace", "", "", dbUseODBC)
    MyODBCConnectString = "ODBC;DSN=" & global_dsn_name() & ";"
    Set MyConnection = MyWorkspace.OpenConnection("Connection1", dbDriverNoPrompt, , MyODBCConnectString)
    MySQLString = "SELECT * FROM public." & """" & query & """" & "('" & p & "');"
    Set MyRecordset = MyConnection.OpenRecordset(MySQLString, dbOpenDynamic)
    
    With MyRecordset
        Do While Not .EOF
        
            Debug.Print _
            MyRecordset("id") & " / " & _
            MyRecordset("foo1") & " / " & _
            MyRecordset("foo2") & " / " & _
            MyRecordset("foo3") & " / " & _
            MyRecordset("foo4")
            
            .MoveNext
        Loop
    End With
    
    MyRecordset.Close
    Set MyRecordset = Nothing
    
    MyConnection.Close
    Set MyConnection = Nothing
    
    MyWorkspace.Close
    Set MyWorkspace = Nothing

query_runExit:
    Exit Sub

query_runError:
    MsgBox "Error in query_run."
    Resume query_runExit
End Sub 

3) How you use it:
------------------
query_run("search_your_tbl_name", "test%")

4) MS Access & reports:
-----------------------
The problem with MS Access is that sometimes you may want to use the result of your stored procedure in a report, for example. In this case, you have to store the query instead of simply running it. You won't need this with VB6, but I put the code here also, it might help others.

Sub search_store(query As String, p As String)
On Error GoTo search_storeError

    Dim MyDatabase As DAO.DataBase
    Dim MyQueryDef As DAO.QueryDef
    
    Set MyDatabase = CurrentDb()
    If (QueryExists(query)) Then MyDatabase.QueryDefs.Delete query
    Set MyQueryDef = MyDatabase.CreateQueryDef(query)

    MyQueryDef.Connect = "ODBC;DSN=" & global_dsn_name() & ";"
    MyQueryDef.SQL = "SELECT * FROM public." & """" & query & """" & "('" & p & "');"
    MyQueryDef.ReturnsRecords = True
    
    MyQueryDef.Close
    Set MyQueryDef = Nothing
    
    MyDatabase.Close
    Set MyDatabase = Nothing
    
search_storeExit:
    Exit Sub

search_storeError:
    MsgBox "Error in search_store."
    Resume search_storeExit
End Sub


This routine creates a querydef called "search_your_tbl_name" you can incorporate in a report.

________________________________

De : pgsql-odbc-owner@postgresql.org [mailto:pgsql-odbc-owner@postgresql.org] De la part de Sandro Yaqub Yusuf
Envoyé : lundi, 4. octobre 2004 21:13
À : pgsql-odbc@postgresql.org
Objet : [ODBC] Executing SP in VB6


Hello,
 
Please, I just trying search in all WEB SITES about using STORED PROCEDURES with VISUAL BASIC, but I not found anything about this that can help me.
 
I have a table: USERS with colums IDUSER, USER, PASSWORD, FULLNAME
I need get the colum FULLNAME with parameter USER.
How I do to create and execute a STORED PROCEDURE in VISUAL BASIC 6 to resolve this litle problem ? (please, forgiven my english because I living in BRAZIL and not speak english).
 
Thanks,
 
Sandroyy
 




^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2004-10-05 06:45 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-10-04 19:13 Executing SP in VB6 Sandro Yaqub Yusuf <sandro@proservvi.com.br>
2004-10-04 19:15 Re: Executing SP in VB6 Goulet, Dick <DGoulet@vicr.com>
2004-10-04 19:24 ` Sandro Yaqub Yusuf <sandro@proservvi.com.br>
2004-10-04 21:52   ` Sandro Yaqub Yusuf <sandro@proservvi.com.br>
2004-10-05 01:31   ` Iain <iain@mst.co.jp>
2004-10-05 02:07   ` Iain <iain@mst.co.jp>
2004-10-04 23:29 Re: Executing SP in VB6 Andrew Ayers <aayers@eldocomp.com>
2004-10-05 06:45 Re: Executing SP in VB6 Philippe Lang <philippe.lang@attiksystem.ch>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox