在ASP .NET中找不到表0 [英] Can't find a table 0 in ASP .NET

查看:104
本文介绍了在ASP .NET中找不到表0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,



我有一些错误我找不到该错误:在重新调整价值时找不到表格0



Dear Friends,

I have some Error i can't find out that error: can't find table 0 at retun value.

private DataTable deleteSession(string userSession, string mode)
        {
            DataSet dsData1 = new DataSet();
            SqlConnection sqlCon;
            SqlDataAdapter sqlCmd;

            try
            {
                using (sqlCon = new SqlConnection(ConfigurationManager.ConnectionStrings["conString"].ConnectionString))
                {
                    sqlCmd = new SqlDataAdapter("USP_UserLogin", sqlCon);
                    sqlCmd.SelectCommand.CommandType = CommandType.StoredProcedure;
                    sqlCmd.SelectCommand.Parameters.AddWithValue("@loginID",userSession);
                    sqlCmd.SelectCommand.Parameters.AddWithValue("@password", string.Empty);
                    sqlCmd.SelectCommand.Parameters.AddWithValue("@sessionID", string.Empty);
                    sqlCmd.SelectCommand.Parameters.AddWithValue("@mode", mode);
                    sqlCon.Open();
                    sqlCmd.Fill(dsData1);
                    sqlCon.Close();
                }
            }
            catch
            {
                throw;
            }
            return dsData1.Tables[0];
        }

       

        protected void hnkLogOut_Click(object sender, EventArgs e)
        {
            deleteSession(Convert.ToString(Session["UserID"]), "LOGOUT");
            Session.Abandon();
           // Server.Transfer("~/Login.aspx");
            Response.Redirect("Login.aspx?mode=logout");
        }





[UpDate]

我解决了这个找不到表问题..现在无法更新值。我正在使用sp。



[UpDate]
I solved this can't find table problem... Now can't update the values. am using sp for this.

IF @mode = 'LOGOUT'
BEGIN

	UPDATE [Users]
	SET IsLogin = 0 ,
		userSession = '' 
	WHERE LoginID = @loginID 
          SELECT 0
END





[UpDate]

但是,这已执行:



[UpDate]
But, this Executed:

IF @mode = 'CHANGELOGIN'
BEGIN
	UPDATE [Users]
	SET IsLogin = 1 ,
		userSession = @sessionID ,
		LastLogin = GETDATE() 
	WHERE LoginID = @loginID 
	SELECT 1
END





我尝试了什么:



没有更新sp代码...在c#和sp代码上面注销任何错误。



What I have tried:

didn't update that sp code... above c# and sp code for logout any mistakes in that.

推荐答案

1。你在这里问过两个不同的问题。在您解决了第一个问题后,您应该已经发布了解决方案,然后打开了一个新问题

2.您的更新代码看起来很好,所以如果它没有按照您的要求进行调试,那么您必须对其进行调试。我们都不知道你想要它做什么,我们都不能运行你的代码所以你必须调试它。



你说你想要的SQL代码没有运行但是另一个代码呢?您应该立即看到变量@mode不是您认为应该的那样。



在代码上放置断点并查看正在执行的sql。这实际上是一个非常简单的问题,需要自行解决。
1. You have asked 2 different questions here. After you solved your first question you should have posted the solution and then opened a new question
2. Your update code looks fine so if it is not doing what you want then you have to debug it. None of us know what you want it to do and none of us can run your code so you have to debug it.

You say the SQL code that you wanted to didn't run but another code did? You should see right away then that the variable @mode was not what you thought it should be.

Put breakpoints on your code and see what sql is being executed. This is actually a very simple problem to fix on your own.


这篇关于在ASP .NET中找不到表0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆