Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
N

N Mohamed rafi

@N Mohamed rafi
About
Posts
51
Topics
10
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Inserting Through Radionbutton and checkbox
    N N Mohamed rafi

    yes sir need to select any one at a time. and i am using mysql not sql

    C# database mysql com sales question

  • Inserting Through Radionbutton and checkbox
    N N Mohamed rafi

    My insert code is not working fine, bcz if i click radionbutton2 and checkbox 2 means it was inserting data automatically radionbutton1 and checkbox1 only, actually if which textbox is selected that data should enter null value radionbutton data should not saved in db if (!string.IsNullOrEmpty(textBox11.Text) && !string.IsNullOrEmpty(textBox12.Text) && !string.IsNullOrEmpty(textBox13.Text) && !string.IsNullOrEmpty(textBox14.Text) && (radioButton1.Checked || radioButton2.Checked) && (checkBox1.Checked || checkBox2.Checked))             {                 string connectionString;                 MySqlConnection cnn;                 connectionString = @"Data Source=localhost;Initial Catalog=testDB;User ID=root;Password=mysql";                 cnn = new MySqlConnection(connectionString);                 cnn.Open();                 string id = textBox14.Text;                 string name = textBox11.Text;                 string year = textBox12.Text;                 string quality = radioButton1.Text == "" ? radioButton2.Text : radioButton1.Text;                 string taste = checkBox1.Text == "" ? checkBox2.Text : checkBox1.Text;                 string sales = textBox13.Text;                 textBox11.Text = "";                 textBox12.Text = "";                 textBox13.Text = "";                 textBox14.Text = "";                 radioButton1.Text = "";                 radioButton2.Text = "";                 checkBox1.Text = "";                 checkBox2.Text = "";                 string query = "INSERT INTO fruits VALUES(@fruitsid, @fruitsname, @fruitsyear, @quality, @taste, @sales)";                 using (MySqlCommand cmd = new MySqlCommand(query))                 {                     cmd.Parameters.AddWithValue("@fruitsid", Convert.ToInt32(id));                     cmd.Parameters.AddWithValue("@fruitsname", name);                     cmd.Parameters.AddWithValue("@fruitsyear", year);                     cmd.Parameters.AddWithValue("@quality", quality);                     cmd.Parameters.AddWithValue("@taste", taste);                     cmd.Parameters.AddWithValue("@sales", sales);                     cmd.Connection = cnn;                     cmd.ExecuteNonQuery();                     MessageBox.Show("Record Inserted Successfully");                     DisplayData();                     cnn.Close();

    C# database mysql com sales question

  • Password CAPS not Checking in my code
    N N Mohamed rafi

    Please provide solution or idea

    C# database mysql tutorial question

  • Password CAPS not Checking in my code
    N N Mohamed rafi

    ok provide solution and article link pls

    C# database mysql tutorial question

  • Password CAPS not Checking in my code
    N N Mohamed rafi

    I saved my password in CAPS includes but if i enter in small letters its also logged in how to change it?

    private void button14_Click(object sender, EventArgs e)
    {
    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 count(*) 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();
    int result = Convert.ToInt32(cmd.ExecuteScalar());
    DialogResult dr = MessageBox.Show("Are you sure to Login now?", "Confirmation", MessageBoxButtons.YesNo);
    if (dr == DialogResult.Yes && result > 0)
    {
    MessageBox.Show("Login Successfully");
    cnn.Close();
    this.Hide();
    Form2 f2 = new Form2();
    f2.ShowDialog();
    }
    else
    {
    MessageBox.Show("Login Failed");
    }
    }
    }
    else
    {
    MessageBox.Show("Please Enter Correct Login details");
    }

        }
    }
    
    C# database mysql tutorial question

  • Error on Coding
    N N Mohamed rafi

    Error:

    the name cmd does not exist in current context

    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 count (*) from login where userid='" + textBox9.Text + "' and password='" + textBox10.Text + "'";
    int count = Convert.ToInt32(cmd.ExecuteScalar());
    using (MySqlCommand cmd = new MySqlCommand(query))
    if (count >= 1)
    {
    cmd.Parameters.AddWithValue("@userid", id);
    cmd.Parameters.AddWithValue("@password", password);
    cmd.Connection = cnn;
    cnn.Open();
    cmd.ExecuteNonQuery();
    MessageBox.Show("Login Successfully");
    cnn.Close();
    this.Hide();
    Form2 f2 = new Form2();
    f2.ShowDialog();
    }
    else
    {
    MessageBox.Show("Please Enter Correct Login details");
    }

            }
            else
            {
                MessageBox.Show("Please Enter Details to Login");
            }
    
    C# database mysql help

  • Mysql Query Error
    N N Mohamed rafi

    I have stored userid and password in mysql database, this query is showing login successfully for not stored data, so please correct it

    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();

    C# database mysql help question

  • C# to Mysql Login code Error
    N N Mohamed rafi

    Waste of time in this forum. Bye

    C# csharp database mysql help question

  • C# to Mysql Login code Error
    N N Mohamed rafi

    Sir, Now you give the right code or not?

    C# csharp database mysql help question

  • C# to Mysql Login code Error
    N N Mohamed rafi

    Pls correct and send me in my code sir that why i can understand sir send me please

    C# csharp database mysql help question

  • C# to Mysql Login code Error
    N N Mohamed rafi

    Sir, You all are blaming me always, you know the code but you are not providing me. Thank you all.

    C# csharp database mysql help question

  • C# to Mysql Login code Error
    N N Mohamed rafi

    Sir, How to write mysql query if stored userid password is correct means then it enter successfull suppose not stored values entered means the messagebox is wrong.....

    C# csharp database mysql help question

  • C# to Mysql Login code Error
    N N Mohamed rafi

    Why you are not correcting my code and sending me? i said the error you know the code and sending some examples also then you can send correct code it is useful to me please

    C# csharp database mysql help question

  • C# to Mysql Login code Error
    N N Mohamed rafi

    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");
    }

    C# csharp database mysql help question

  • C# to Mysql Login code Error
    N N Mohamed rafi

    Put the same code in my code that why i can understand easily sir

    C# csharp database mysql help question

  • C# to Mysql Login code Error
    N N Mohamed rafi

    How to change code in my coding like this sir? because my code is logging in if i enter wrong username and password also

    C# csharp database mysql help question

  • C# to Mysql Login code Error
    N N Mohamed rafi

    I clearly telling again mysql query is error here, ExecuteNonQuery is returned value it means i logged in with wrong userid and password also.

    C# csharp database mysql help question

  • C# to Mysql Login code Error
    N N Mohamed rafi

    Sir, I pay attention sir, you said i am passing 2parameters now i am passing 3parameters and login means it shows login successful with wrong userid password also i think my sql query should be change here

    C# csharp database mysql help question

  • C# to Mysql Login code Error
    N N Mohamed rafi

    Sir, I have passed 3parameters but still it login in with wrong user id password also, how to write correct mysql query here?

    string connectionString;
    MySqlConnection cnn;
    connectionString = @"Data Source=localhost;Initial Catalog=testDB;User ID=root;Password=mysql";
    cnn = new MySqlConnection(connectionString);
    //cnn.Open();
    string id = textBox9.Text;
    string password = textBox10.Text;
    string loginid = "";
    textBox9.Text = "";
    textBox10.Text = "";
    string query = "select * from login where userid=@userid and password=@password and loginid=@loginid";
    using (MySqlCommand cmd = new MySqlCommand(query))
    {
    cmd.Parameters.AddWithValue("@userid", id);
    //cmd.Parameters.AddWithValue("@employee_id", Convert.ToInt32(id));
    cmd.Parameters.AddWithValue("@password", password);
    cmd.Parameters.AddWithValue("@loginid", loginid);
    //cmd.Parameters.AddWithValue("@confirmpassword", confirmpassword);
    cmd.Connection = cnn;
    cnn.Open();
    cmd.ExecuteNonQuery();
    DialogResult dr = MessageBox.Show("Are you sure to Login now?", "Confirmation", 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 details to Login");
    }
    }

    C# csharp database mysql help question

  • C# to Mysql Login code Error
    N N Mohamed rafi

    Sir, how to save password securely? pls suggest in my code and mysql query also wrong bcz it login with wrong userid and password also

    C# csharp database mysql help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups