Mengxin solved the value of C-sharp database?

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?

clipboard.png

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)

what result do you expect? What is the error message actually seen?

Jan.26,2022

after running one by one, I found that after running to if (uPwd = = textBox2.Text.Trim ()), I directly ran the else solution

  • SQL look up data

    when querying SQL, you need to process the data to find the difference. Some units are hours, times, and seconds. For example, when an hour subtracts seconds, the second should be converted to an hour with a difference less than a certain value to send m...

    Mar.22,2021
  • C-sharp link SQL SERVERE connection failed

    { string strConnection = "Server=DESKTOP-TH8QSR9;"; strConnection += "initial catalog=test;"; strConnection += "user id=DESKTOP-TH8QSR9 suchao;"; strConnection += "password=;"...

    Mar.22,2021
  • Query 100000 items of data with SQL or JSON+LINQ?

    I have a dataset with a size of about 100000. The dataset is rarely added or updated, mainly because of frequent query operations, efficient query, and regardless of memory footprint and preload time. Which solution is better to use SQL or JSON+LINQ? ...

    Mar.21,2022
  • Query 100000 items of data with SQL or JSON+LINQ?

    I have a dataset with a size of about 100000. The dataset is rarely added or updated, mainly because of frequent query operations, efficient query, and regardless of memory footprint and preload time. Which solution is better to use SQL or JSON+LINQ? ...

    Mar.21,2022
  • Query 100000 items of data with SQL or JSON+LINQ?

    I have a dataset with a size of about 100000. The dataset is rarely added or updated, mainly because of frequent query operations, efficient query, and regardless of memory footprint and preload time. Which solution is better to use SQL or JSON+LINQ? ...

    Mar.21,2022
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e54acf-452c0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e54acf-452c0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?