当前位置: 代码迷 >> ASP.NET >> 无法将类型“System.Data.SqlClient.SqlDataReader”隐式转换为“System.Data.SqlClient.SqlDataAdapter”,该怎么处理
  详细解决方案

无法将类型“System.Data.SqlClient.SqlDataReader”隐式转换为“System.Data.SqlClient.SqlDataAdapter”,该怎么处理

热度:4191   发布时间:2013-02-25 00:00:00.0
无法将类型“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
  相关解决方案