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

无法将类型“System.Data.SqlClient.SqlDataReader”隐式转换为“System.Data.SqlClient.SqlDataAdapter”
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.Sql;
using System.Data.SqlClient;

public partial class login : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {

  }
  protected void submit_Click(object sender, EventArgs e)
  {
  SqlConnection conn = new SqlConnection();
  conn.ConnectionString="server=localhost;database=news;integrated security=SSPI"; 
  conn.Open();
  SqlCommand cmd=new SqlCommand();
  cmd.CommandText="select username,psw from admin_user where username='"+this.tbuser.Text+"';";
  cmd.Connection=conn;
  SqlDataAdapter reader=cmd.ExecuteReader();
  ..........................
代码如上,提示"无法将类型“System.Data.SqlClient.SqlDataReader”隐式转换为“System.Data.SqlClient.SqlDataAdapter” "这是什么问题啊?

------解决方案--------------------
SqlDataAdapter reade
==>
SqlDataReader reade