如何在Linq中设置sp_setapprole以执行存储过程 [英] how to set sp_setapprole In Linq to Excute Stored Procedure
问题描述
我试图执行存储过程..我必须设置sp_SetAppRole来执行它....任何人都可以让我知道...我该如何在Linq中执行该操作...
NavigationDataContext导航=新的NavigationDataContext(数据源= j;初始目录= SynergyOne;集成安全性= True");
Navigation.ExecuteCommand("sp_setapprole" jp," AsnlyetsheienhgC");
我无法为用户"NT AUTHORITY \ ANONYMOUS LOGON"登录.但我无法在sql中访问此文件...
var photo = Navigation.uJPCsp_Portal_StudentDocuments("17",null,null,null);
GridView1.DataSource =照片;
我在google中找不到几个示例,但是什么都不清楚.....
im trying to excute a stored procedure..i have to set sp_SetAppRole to excute it....can anyone please let me know...that how can i do it in Linq...
NavigationDataContext Navigation = new NavigationDataContext("Data Source=j;Initial Catalog=SynergyOne;Integrated Security=True");
Navigation.ExecuteCommand("sp_setapprole ''jp'' ,''AsnlyetsheienhgC''");
im geting Login failed for user ''NT AUTHORITY\ANONYMOUS LOGON''. but im able to access this in sql...
var photo = Navigation.uJPCsp_Portal_StudentDocuments("17", null, null, null);
GridView1.DataSource = photo;
i have found few example in google but nothing is clear.....
any help will be appriciated.
推荐答案
立即听起来您正在使用Windows身份验证而不是SQL身份验证.尝试删除连接字符串中的Integrated Security位,并提供一个sql用户名和密码
例如:
Offhand it sounds like you''re using Windows authentication instead of SQL authentication. Try removing the Integrated Security bit in the connection string and supplying a sql username and password
For example:
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
请查看此页面以获取有关SQL Server连接字符串和示例的更多信息:
http://www.connectionstrings.com/sql-server-2008 [
Check out this page for more info on SQL Server connection strings and examples:
http://www.connectionstrings.com/sql-server-2008[^]
HTH, Good luck.
这篇关于如何在Linq中设置sp_setapprole以执行存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!