在c#中执行exec master..xp_cmdshell的权限问题
using System.Security.Permission; ...
try
{
FileIOPermission writeFile=new FileIOPermission(FileAccess.Write,@"C:\");
writeFile.Demand();
SqlCommand=new SqlCommand(@"exec master..xp_cmdshell 'bcp test.dbo.test out c:\test.xls -c -S"(local)\slqexpress" -U"sa" -P"111"'",conn);
conn.Open();
cmd.ExecuteNonQuery;
conn.Close();
}
这么写不对,该怎么写才能打开c:\的写入能力?