楼主不用哪么复杂
System.Data.SqlClient.SqlDataAdapter ad = new System.Data.SqlClient.SqlDataAdapter("select", "conStr");
DataSet ds = new DataSet();
ad.Fill(ds);
if(ds.Tables[0].Rows.Count==0)
{
Response.Redirect("error.aspx");
}
else
{
Session["users_name"] = ds.Tables[0].row[0]["users_name"].ToString();
Session["users_pwd"] = ds.Tables[0].row[0]["users_pwd"].ToString();
Session["users_id"] = ds.Tables[0].row[0]["users_id"].ToString();
if (Session["users_id"].ToString() == "01")
{
Response.Redirect("manager.aspx");
}
else
{
Response.Redirect("welcom.aspx");
}
}
System.Data.SqlClient.SqlDataAdapter ad = new System.Data.SqlClient.SqlDataAdapter("select", "conStr");
DataSet ds = new DataSet();
ad.Fill(ds);
if(ds.Tables[0].Rows.Count==0)
{
Response.Redirect("error.aspx");
}
else
{
Session["users_name"] = ds.Tables[0].row[0]["users_name"].ToString();
Session["users_pwd"] = ds.Tables[0].row[0]["users_pwd"].ToString();
Session["users_id"] = ds.Tables[0].row[0]["users_id"].ToString();
if (Session["users_id"].ToString() == "01")
{
Response.Redirect("manager.aspx");
}
else
{
Response.Redirect("welcom.aspx");
}
}
解决方案 »
- DataClassesDataContext不包含采用0参数的构造函数
- WebServices返回String类型的字符串出现异常
- C# dataGridView1中运用ToolTip
- c#模拟声音的频率,时值,在音响中播放出声音
- winform里可以使用HtmlEncode这个函数吗?
- 文件写入问题!!
- CompareTo
- c#的客户端能不能调用WebService定义的全局变量啊?如果能怎样调用啦?
- 大家进来谈谈开发WinForm的信息管理系统,中数据的新增,修改,删除的操作是如果实现的,我一直是通过DataSet来的,但存在以下问题.大家指点.
- 发邮件时出现:Could not access CDO NewMail object
- 如何插入flash制作的按钮
- c#+ext js例子
从索引 0 处开始,初始化字符串的格式不符合规范。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.ArgumentException: 从索引 0 处开始,初始化字符串的格式不符合规范。
这是什么