日期:2014-05-17  浏览次数:20587 次

“string”不包含“ExecuteReader”的定义 困扰很久了 拜托各位了
本帖最后由 zggl2009 于 2013-07-04 23:39:33 编辑
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;

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

        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["sqlco1"].ConnectionString);
            con.Open();
            string strselect = "select * form UserTable";
            SqlCommand command = new SqlCommand(strselect, con);

            SqlDataReader reader = strselect.ExecuteReader();
            {
                if (reader.Read())
                {
                    
                    string strselect1 = "select * form UserTable where username='" + TextBox1.Text.Trim() + "'and pwd='" + TextBox2.Text.Trim() + "'";
                    SqlCommand com = new SqlCommand(strselect1, con);
                    SqlDataReader reader1 = strselect1.ExecuteReader();
                    if (reader1.Read())