Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stored procedure for edit log
Message
From
21/11/2008 10:23:24
 
 
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01361756
Message ID:
01363485
Views:
8
>>>>>>
>>>>>>Hi Viv,
>>>>>>
>>>>>>I don't think this
>>>>>>
>>>>>>command.CommandText = "SetUserName('" + sUser + "')";
>>>>>>
>>>>>>is going to work.
>>>>>
>>>>>Hi,
>>>>>Why not?
>>>>
>>>>May be I'm wrong, but I think in CommandText you can only specify the SP name and you have to pass your parameter through Parameters collection of the Command object.
>>>
>>>Worked for me :=}
>>
>>Hey there!!! I found a way to do it!! The germ of the idea came from Viv's comment about passing a parameter in the update command. Here's how it works.
>>1. The table being updated gets a new field "editedby" to act as a temporary place to hold the name of the user performing the update.
>>2. The username is passed to the table being updated as part of the standard update command and is placed in the EDITEDBY field. The update command receives the value of the username as a session parameter.
>>3. The stored proc knows the value it wants for the public variable has not been initialized so it initializes the variable and obtains the value from the table being updated.
>>I've done the code and it works.
>>Thanks to all of you who helped think through this.
>
>Hi,
>On the face of it that looks like requiring a lot more changes than my suggestion. In VFP you needed to modify all the tables that fire the trigger plus the trigger itself (which I thought was the main thing we were trying to avoid) My idea only required using a SP instead of using the update command directly - something that can be a good thing in itself since it offers the possibility of using business logic on the server side.
>
>Anyway, if it works and your happy....
>Best,
>Viv

You may be right, but on the face of it I would have had to write a completly new stored procedure and figured out how to launch it from the Formview's update function. Also I would have had to send in a bunch of parameters etc.etc. Anyway, it works and I'm happy :).
Previous
Reply
Map
View

Click here to load this message in the networking platform