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

搞不明白了,请高手解答(在线等!)
这是我的一个Web服务的方法

[WebMethod]
        public   string   Login(String   userName,   string   password)
        {
                DataSet   ds   =   new   DataSet();
                SqlConnection   conn   =   new   SqlConnection(WebConfigurationManager.ConnectionStrings[ "connString "].ConnectionString);
                if   (conn.State   ==   ConnectionState.Closed)
                {
                        conn.Open();
                }
                string   sqlLogin   =   "select   [Name],Mobile   from   tb_user_Info   where   [Name]= ' "   +   userName   +   " 'and   Pwd= ' "   +   password   +   " ' ";
                try
                {
                        SqlDataAdapter   da   =   new   SqlDataAdapter(sqlLogin,   conn);
                        da.Fill(ds,   "UserTable ");
                        int   k   =   ds.Tables[ "UserTable "].Rows.Count;
                        if   (k   <=   0)
                        {
                                return   "用户名或密码错误! ";
                        }
                        else
                        {  
                                for(int   i   =0;i <=k;i++)
                                {
                                        string   tel   =   ds.Tables[ "UserTable "].Rows[i][ "Mobile "].ToString();
                                        Session[ "Telphone "]   =   tel;       //运行到此就出错误了,说什么未将对象引用设置到对象的实例,这是怎么回事啊????                                
                                }
  &nb