Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Simple question on accessing SQL?
Message
De
18/03/2002 21:12:47
 
 
À
18/03/2002 11:41:30
Information générale
Forum:
Visual Basic
Catégorie:
SQL Server
Divers
Thread ID:
00634102
Message ID:
00634335
Vues:
30
>I am a Visual FoxPro developer and can do this quickly in VFP but the client wants the app done in VB.
>
>Okay, let's finish typing.
>
> I need to connect to SQL Server via a defined ODBC connection, call a stored procedure and display the information. Displaying the information is no problem but I am falling down on connecting to SQL server and calling the SP.
>
> I think I can connect, call the SP in the Load event of the form and do the disconnect in the Unload Event.
>
>Ideas, examples, comments please

Expanding on Ezzeddin's reply, once you have the connection open you can call the sp as if it was a method of the connection object, namely:
Set rs = New ADODB.Recordset
cn.myStoredProcedure "paramVal1", "paramVal2", rs
When using this syntax you need to include the recordset as the last parameter of the call, although the SP only has 2 parameters in the example. If no parameters then just put the rs as the only parameter. On the unload:
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform