我是个菜鸟 能不能帮我看看为什么不会跳转Admin页面
string admin=txtName .Text .Trim ();
string passWord=txtPassWord .Text .Trim ();
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "Data Source=.;Initial Catalog=Admin;Integrated Security=True";
try
{
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "SELECT * FROM Administrator";
cmd.Connection = conn;
SqlDataReader data;
data = cmd.ExecuteReader();
while (data.Read())
{
if (data.GetValue(0).ToString() == admin && data.GetValue(1).ToString() == passWord)
{
Response.Redirect("Admin.aspx");
}
}
data.Close();
conn.Dispose();
}
catch (SqlException ex)
{
Response.Write(ex.Message);
}
至于你在那里怎么调用方法过去你应该知道了把.