If I am my .Net program and try to run it as follows
strConn="Initial Catalog=MyDB;Data Source=MyServer;user id=guest";
SqlConnection oConn=new SqlConnection(strConn);
oConn.Open();
SqlCommand oCmd=new System.Data.SqlClient.SqlCommand("exec sp_setapprole
@rolename='app',@password={Encrypt N'app'},@encrypt='odbc'",oConn);
iResult=(int)oCmd.ExecuteNonQuery();
It throws an error
'Encrypt' is not a recognized ODBC date/time extension option.
If I take out the Encrypt part, as shown below, it works fine.
SqlCommand oCmd=new System.Data.SqlClient.SqlCommand("exec sp_setapprole
@rolename='app',@password='app',@encrypt='odbc'",oConn);
Any ideas on the error?
It appears that SqlClient does not support this syntax. The only work-
around I can think of for the moment is to use the OleDb .Net provider
instead.
There are special newsgroups devoted to ADO .Net, I think you should
consult these as well for better advice.
--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp