日期:2014-05-18  浏览次数:20452 次

net学的郁闷散分顺便谈谈各位高手的经验
本人从asp转过来的,学.net现在越学越郁闷都混淆了!
  在对c#没什么基础是不是应该用vb而不用c#????????
      还有谁有好的教程推荐推荐?
顺便问问题
  if   (Session[ "ausername "]   ==   null)
                {
                        Response.Write( " <script> alert( '请先登陆您的用户! ');document.location= 'login.aspx '; </script> ");
                        Response.End();
                }
                else
                {
                        SqlConnection   conn   =   new   SqlConnection( "user   id=sa;password=123;initial   catalog=aspx;Server=KEYJOB;Connect   TimeOut=120; ");
                        conn.Open();
                        SqlCommand   dkrs   =   new   SqlCommand( "select   *   from   admin   where   ausername= ' "   +   Convert.ToString(Session[ "ausername "])   +   " ' ",   conn);
                        SqlDataReader   rs=   dkrs.ExecuteReader();
                        if   (rs.Read())//?????这里如何判断????
                        {
                                Response.Redirect( "Default.aspx ");
                        }
                        else
                        {
                                Response.Write( " <script> alert( '非法用户枪毙! ');window.close(); </script> ");
                                Response.End();
                        }
                }
?那里如何判断????????????

------解决方案--------------------
哈哈,果然你又开一贴啦。先抢个位置先。
------解决方案--------------------
http://www.microsoft.com/china/msdn/events/webcasts/shared/Webcast/MSDNWebCast.aspx

上面很多教程
------解决方案--------------------

------解决方案--------------------
1 我记得是rs.hasRows()
2 没见过Response.End。
你试试
Page.RegisterStartupScript( " ", " <script..... ")
------解决方案--------------------
if (rs.Read())//?????这里如何判断????
{
================
rs.read()如果是true就表示用户已经在数据库中找到了,那么这是个合法用户