How can I execute a T-SQL SET-command for a SQL-server connection from my C#-application?
Posted on 2009-03-30
I need to execute two SET-commands for a SQL-server connection from my C#-application, namely:
I am wondering where/how I can issue these commands. It doesn't work in the SqlCommand.CommandText. Prepending them to the normal CommandText results in an error.
An optimal way for me would be to include the SET-commands in the connection-string or execute them via a SqlConnection object. Their effect should last for the entire connection. Anyway I couldn't figure out a way to do so.
I am using Visual Studio 2005, .net framework 2.0 and SQL-server 2000.
Any help is greatly appreciated.
Thanks, Wei Xi