Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling an Update Stored Procedure.
Message
Information générale
Forum:
ASP.NET
Catégorie:
Visual FoxPro Toolkit pour .NET
Divers
Thread ID:
00674696
Message ID:
00675103
Vues:
30
Thank you very much. That did the trick.



>Where you call SQLExecute(), replace that line with the following:
>
>oconn.Open()
>oCommand.ExecuteNonQuery()
>
>>So then the question is, "How can I send updates to the Database?"
>>
>>
>>
>>>You need to pass a select statement to the Toolkit's SQLExecute function. It then returns a filled DataView. This function is not intended to pass an Update statement. This is being considered to be revised for a future update to the toolkit.
>>>
>>>>Here is the code.
>>>>
>>>>********* Save Routine *****
>>>> ' Set up connection and command
>>>> Dim oconn As System.Data.OleDb.OleDbConnection
>>>> Dim oCommand As New OleDbCommand()
>>>>
>>>> ' passing parameter to stored procedure
>>>> ' I have tried both Char and VarChar for OLEdb
>>>> Dim oparam1 As New OleDbParameter("@cssn", OleDb.OleDbType.VarChar)
>>>>
>>>> ' gcpuem is a memvar which contains the connectin string
>>>> oconn = SqlConnect(gcPuem)
>>>>
>>>> oCommand.CommandType = CommandType.StoredProcedure
>>>>
>>>> ' _TestUpdate is the SP being called, code is below.
>>>> oCommand.CommandText = "_TestUpdate"
>>>>
>>>> oCommand.Parameters.Clear()
>>>> 'storing employee ssn, value is 000110000
>>>> oparam1.Value = Me.txtcssn.ClipText
>>>> oCommand.Parameters.Add(oparam1)
>>>>
>>>> ' Bug in ToolKit, should be fixed in future release but need this
>>>> ' code for now.
>>>> oCommand.Connection = oconn
>>>>
>>>> ' Tried both of the following lines with the same results.
>>>> ' gvEmployee = SqlExecute(oconn, oCommand) ', "curEmployee")
>>>> SqlExecute(oconn, oCommand)
>>>>
>>>> ' Close the connection
>>>> SqlDisConnect(oconn)
>>>>
>>>>
>>>>*** Stored Procedure Code ***
>>>>
>>>>CREATE PROCEDURE _TestUpdate
>>>>' Test SP only!
>>>>@cssn as char(9)
>>>>
>>>>AS
>>>>
>>>>update pclaim set cssn = @cssn where pid = 2
>>>>GO
Fred Lauckner

You know, it works on my computer. I don't know what your problem is.

.Net aint so bad.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform