General information
Category:
Visual FoxPro and .NET
Environment versions
Network:
Windows 2008 Server
>>>>
>>>>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.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only