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.Data;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string mystr;
SqlConnection myconn = new SqlConnection();
mystr = "Data Source = localhost;Initial Catalog = eat;" + "Integrated Security = False; User Id = sa; Password = mgx";
myconn.ConnectionString = mystr;
try
{
myconn.Open();
SqlCommand mycmd = new SqlCommand("select 密码 from eat where 账号 = @账号", myconn);
mycmd.Parameters.Add("@账号",SqlDbType.VarChar).Value = TextBoxlogin1.Text.Trim();
SqlDataReader dr = mycmd.ExecuteReader();
/*if (dr[0].ToString() == TextBoxlogin2.Text.ToString())
{
Button1.Text = "成功";
}
else
Button1.Text = "失败";*/
//dr.Close();
}
catch
{
}
finally
{
myconn.Close();
}
}
}