sources of topics and their own ideas
related codes
/ / Please paste the code text below (do not replace the code with pictures)
string cString = "data source=.;initial catalog=project;integrated security=true;";
SqlConnection sConnection = new SqlConnection(cString);
sConnection.Open();
SqlCommand sCommand = new SqlCommand("select * from login where Uname=@Uname", sConnection);
SqlParameter sqUname = new SqlParameter("@Uname", textBox1.Text);
sCommand.Parameters.Add(sqUname);
SqlDataReader sReader = sCommand.ExecuteReader(CommandBehavior.CloseConnection);
if (sReader.HasRows)
{
sReader.Read();
string uPwd = sReader["Upwd"].ToString();
if (uPwd == textBox2.Text.Trim())
{
string uID = sReader["UID"].ToString();
string uName = sReader["Uname"].ToString();
User user = new User(uID, uName, uPwd);
Form2 f2 = new Form2();
f2.Show();
Hide();
}
what result do you expect? What is the error message actually seen?
problem description
UPwd value is empty after breakpoint debugging
there are UID 001 / username ss;Upwd 111 in the database
the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)