English 中文(简体)
ASP. NET储存了电传电话,没有浏览,但在管理演播室里这样做!
原标题:ASP.NET stored proc call bringing back no rows, but does in Management Studio!

我有一个不容置疑的奇怪问题,我一直试图将问题固定在近一天,现在我反对砖瓦,需要帮助!

我在7<>/em>上建立了4个C#网站。 PC, 新安装的SqlServer 2008 Express R2,所有工作均罚款。

I have uploaded the database and website. The website is now on a Windows Web Server 2008 R2 (with service pack 1) The Database is on a different server running Windows Server 2008 R2 Standard with SQL Server 2008 R2.

除一页外,网站的其余部分正在实行罚款,与数据库的罚款相连接,而我已将其缩小到一个储存的程序,即不收网。

我简化了这方面的呼吁:

DataSet ds = new DataSet();
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["myConn"].ToString());
        SqlCommand cmd = new SqlCommand("MYSP  param1 , param2, param3", conn);
        cmd.CommandType = CommandType.Text;
        conn.Open();
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        da.Fill(ds);
        Response.Write("ROWS COUNT IN GET DS " + ds.Tables[0].Rows.Count);
        conn.Close();
        cmd.Dispose();
        return ds;

对于以上任何一种情况,如果我用一个准确的数据库复印件在我的当地个人计算机上操作,就会把2个浏览器归还,如果我直接在Sqlserver管理演播室操作现场服务器,则会归还2个浏览器,但如果我通过协会管理。 现场服务器上的网点是,它不收任何row!

谁能打下任何灯? 我正在 in!

<>Update,尽管我使用指挥型文字,但我已尝试把它作为带有分离束缚的指挥型储存程序(如下文),但没有任何区别。

cmd.CommandType = StoredProcedure;
    cmd.Parameters.Add(new SqlParameter("@param1", param1));
            cmd.Parameters.Add(new SqlParameter("@param2", param2));
            cmd.Parameters.Add(new SqlParameter("@param3", param3));

<>>>>>

感谢大家的评论!

答案是:

该网站使用的db用户为“英国英语”(缺席)。 我这样做是因为它拥有一个新的服务器!

在其他地方,用户被设定为“英语”,从而将用户改用英语。

最佳回答

通常做的是尝试:当你重新登录到数据库以管理你的询问时,你是否以SAME用户的身份使用 as网程序? 你们也许会发现,如果你重新使用两个用户的话,他们会以不同的方式(一种是EN-GB,一种是EN-US)建立起来,这将给你带来基于奇日期的问题? 而且,你可能发现这两种情况都有所不同,因此,其中一种权利带有诱惑力,而另一种权利不是?

问题回答

如果是 存储程序,请您打上。 储存程序:

DataSet ds = new DataSet();

using(SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["myConn"].ToString()))
using(SqlCommand cmd = new SqlCommand("MYSP  param1 , param2, param3", conn))
{  
    cmd.CommandType = CommandType.StoredProcedure;  <== STORED PROCEDURE !!
     ......

}

Update:,因为你重新执行带有参数的储存的胎面,你或许应当使用:

using(SqlCommand cmd = new SqlCommand("exec dbo.MYSP  param1 , param2, param3", conn))

随后又使用<代码>CommandType.Text

利用服务器简介仪收集你生产协会发出的实际储存程序电话。 然后,网络服务器对你的发展设置也一样。 确保所使用的参数相同。

如果参数与这一水平相匹配,看来唯一可行的答案是,你的同事复杂的“特殊方案”有一些非决定性的组成部分,正在篡改你们的成果。 你们是否理解整个方案?

Ok, 野火在这里射击,但我注意到你正在做ds.Tables[0]。 Rows.Count,我想知道,贵国储存的程序是否正在归还多个数据表? 到目前为止,最好的答案是从@pseudocoder到利用简介员来了解实际需要的东西。 我还建议,在你的法典中设置一个突破点,并审查数据集。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!