Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Are Stored Procedures Supported?
Message
 
À
01/06/2002 10:00:43
Information générale
Forum:
ASP.NET
Catégorie:
Visual FoxPro Toolkit pour .NET
Divers
Thread ID:
00663789
Message ID:
00663836
Vues:
14
Hi Frank,

> I need to be able to execute a Store Procedure. If I copy the SP and execute the code via SQLEXECUTE it runs without errors. If I just call the SP, I get an error.

Sorry, I must have missed your previous request on this issue. Here is an example that demonstrates how to call a stored procedure using the VFP Toolkit for .NET
Dim lcConnectionString As String
Dim oConn As OleDbConnection
Dim oCommand As New OleDbCommand()

'Specify the connection string
lcConnectionString = "Provider=SQLOleDb; server=(local); database=VFPToolkitNET; UID=sa; Pwd="

'Specify the stored procedure. (In my case GetVFPCommand)
oCommand.CommandText = "GetVFPCommand"
oCommand.CommandType = CommandType.StoredProcedure

'Create a new parameter and add it to the parameters collection
Dim oParam1 As New OleDbParameter("@t_Command", OleDb.OleDbType.VarChar)
oParam1.Value = "ALEN"
oCommand.Parameters.Add(oParam1)

'Connect to the Database, execute the query and disconnect
'SqlConnect(), SqlExecute(), SqlDisconnect()
oConn = SqlConnect(lcConnectionString)

'Extra step required in this release of toolkit. This will be fixed in a future release
oCommand.Connection = oConn

'Execute and disconnect
goView = SqlExecute(oConn, oCommand, "CustomerList")
SqlDisConnect(oConn)

'Select the default cursor
VFPToolkit.vfpData.Select(goView)
Browse()
There is a bug in the toolkit that requires an extra step to call stored procedures. It has been fixed for the next release.
'Requires specifying the connection explicitely when calling stored procedures
oCommand.Connection = oConn
Hope this helps,
Kamal
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform