Click here to Skip to main content
15,389,668 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi21-Mar-22 23:37
MemberN Mohamed rafi21-Mar-22 23:37 
GeneralRe: C# to Mysql Login code Error Pin
Richard Deeming21-Mar-22 23:44
mveRichard Deeming21-Mar-22 23:44 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi21-Mar-22 23:47
MemberN Mohamed rafi21-Mar-22 23:47 
RantRe: C# to Mysql Login code Error Pin
Richard Deeming22-Mar-22 0:03
mveRichard Deeming22-Mar-22 0:03 
GeneralRe: C# to Mysql Login code Error Pin
Richard MacCutchan22-Mar-22 0:47
mveRichard MacCutchan22-Mar-22 0:47 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi22-Mar-22 0:49
MemberN Mohamed rafi22-Mar-22 0:49 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi22-Mar-22 0:51
MemberN Mohamed rafi22-Mar-22 0:51 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi22-Mar-22 0:54
MemberN Mohamed rafi22-Mar-22 0:54 
I have changed my code sir, but still logging in for wrong userid and password

if (textBox9.Text != "" && textBox10.Text != "")
            {
                string connectionString;
                MySqlConnection cnn;
                connectionString = @"Data Source=localhost;Initial Catalog=testDB;User ID=root;Password=mysql";
                cnn = new MySqlConnection(connectionString);
                string id = textBox9.Text;
                string password = textBox10.Text;
                textBox9.Text = "";
                textBox10.Text = "";
                string query = "select * from login where userid=@userid and password=@password";
                using (MySqlCommand cmd = new MySqlCommand(query))
                {
                   cmd.Parameters.AddWithValue("@userid", id);
                   cmd.Parameters.AddWithValue("@password", password);
                    cmd.Connection = cnn;
                    cnn.Open();
                    cmd.ExecuteNonQuery();
                    DialogResult dr = MessageBox.Show("Are you sure to Login now?", "Confirmation Message", MessageBoxButtons.YesNo);
                    if (dr == DialogResult.Yes)
                    {
                        MessageBox.Show("Login Successfully");
                        cnn.Close();
                        this.Hide();
                        Form2 f2 = new Form2();
                        f2.ShowDialog();
                    }
                    else if (dr == DialogResult.No)
                    {
                        MessageBox.Show("Please Enter Correct Login details");
                    }
                }
            }
            else
            {
                MessageBox.Show("Please Enter With Correct Login Details");
            }

GeneralRe: C# to Mysql Login code Error Pin
Richard MacCutchan22-Mar-22 0:57
mveRichard MacCutchan22-Mar-22 0:57 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi22-Mar-22 1:06
MemberN Mohamed rafi22-Mar-22 1:06 
GeneralRe: C# to Mysql Login code Error Pin
Richard MacCutchan22-Mar-22 1:09
mveRichard MacCutchan22-Mar-22 1:09 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi22-Mar-22 1:24
MemberN Mohamed rafi22-Mar-22 1:24 
GeneralRe: C# to Mysql Login code Error Pin
Richard MacCutchan22-Mar-22 1:28
mveRichard MacCutchan22-Mar-22 1:28 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi22-Mar-22 1:37
MemberN Mohamed rafi22-Mar-22 1:37 
GeneralRe: C# to Mysql Login code Error Pin
Dave Kreskowiak22-Mar-22 2:57
mveDave Kreskowiak22-Mar-22 2:57 
GeneralRe: C# to Mysql Login code Error Pin
Richard MacCutchan21-Mar-22 22:46
mveRichard MacCutchan21-Mar-22 22:46 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi21-Mar-22 22:49
MemberN Mohamed rafi21-Mar-22 22:49 
GeneralRe: C# to Mysql Login code Error Pin
Richard MacCutchan21-Mar-22 23:10
mveRichard MacCutchan21-Mar-22 23:10 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi21-Mar-22 23:26
MemberN Mohamed rafi21-Mar-22 23:26 
GeneralRe: C# to Mysql Login code Error Pin
Richard MacCutchan21-Mar-22 23:42
mveRichard MacCutchan21-Mar-22 23:42 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi21-Mar-22 23:49
MemberN Mohamed rafi21-Mar-22 23:49 
GeneralRe: C# to Mysql Login code Error Pin
Richard MacCutchan21-Mar-22 23:55
mveRichard MacCutchan21-Mar-22 23:55 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi22-Mar-22 1:32
MemberN Mohamed rafi22-Mar-22 1:32 
GeneralRe: C# to Mysql Login code Error Pin
Dave Kreskowiak22-Mar-22 1:43
mveDave Kreskowiak22-Mar-22 1:43 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi22-Mar-22 1:44
MemberN Mohamed rafi22-Mar-22 1:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.