我的页面没有重定向到我指定的页面。当我这样做时,它说The name "Response" does not exist in the current context
请帮助我在注册时获取数据库中的寄存器值。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace LoginSystem123
{
public partial class Login : Form
{
public Login()
{
InitializeComponent();
}
private void buttonLogin_Click(object sender, EventArgs e)
{
var myConnection = new SqlConnection();
myConnection.ConnectionString = @"Data Source=mukesh-PC\SQLEXPRESS;Initial Catalog=testDb;Integrated Security=True;Pooling=False";
var myCommand = new SqlCommand();
var cmd = "SELECT * FROM [User] Where [User].Email =" + "'" + textBoxEmail.Text + "'";
myCommand.CommandText = cmd;
myCommand.CommandType = CommandType.Text;
myCommand.Connection = myConnection;
myConnection.Open();
var myReader = myCommand.ExecuteReader();
bool isRegisteredUser = myReader.Read();
if (isRegisteredUser)
{
var PasswordFromDatabase = myReader.GetString(5);
if (textBoxPassword.Text == PasswordFromDatabase.TrimEnd())
{
MessageBox.Show("Successfully Logged on !");
}
else
{
MessageBox.Show("Invalid password. Try again");
}
}
else
{
MessageBox.Show("Invalid user");
}
}
/* private void buttonSignUp_Click(object sender, EventArgs e)
{
Response.Redirect("SignUp.cs");
}
*/
private void buttonSignUp_Click_1(object sender, EventArgs e)
{
Response.Redirect("SignUp.cs");
}
}
}