Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
password image login not work incorrect message

What I have tried:

C#
try
            {

                if (!(textBox1.Text == string.Empty))
                {
                    //if (!(pictureBox1.Image == string.Empty))
                    if (!(pictureBox1.Image == null))
                   
                    {
                    //    this.pictureBox1.Image.Dispose();
                    //    this.pictureBox1.Image = null;
                    }
                    System.Drawing.Imaging.ImageFormat.Jpeg);
                    {
                        SqlConnection con = new SqlConnection();
                        con.ConnectionString = "Data Source=DESKTOP-8BEJFRN\\SQLEXPRESS;Initial Catalog=win;Integrated Security=True";
                        con.Open();
                        SqlCommand cmd = new SqlCommand("SELECT username,pic FROM pe WHERE username='" + textBox1.Text + "' and pic='" + pictureBox1.Image + "'", con);
                        SqlDataReader dr = cmd.ExecuteReader();
Posted
Updated 30-Jul-18 1:43am
v3

1 solution

"not work incorrect message"
That means nothing. Please provide proper details of your problem, no one here can guess what you are doing wrong.
 
Share this answer
 
Comments
Member 13847218 30-Jul-18 8:00am    
try
{

if (!(textBox1.Text == string.Empty))
{
//if (!(pictureBox1.Image == string.Empty))
if (!(pictureBox1.Image == null))

{

// this.pictureBox1.Image = null;
}
//FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
//this.pictureBox1 = System.Drawing.Image.FromStream(fs);

//if (MemoryStream ms = new MemoryStream();
// pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=DESKTOP-8BEJFRN\\SQLEXPRESS;Initial Catalog=win;Integrated Security=True";
con.Open();
SqlCommand cmd = new SqlCommand("SELECT username,pic FROM pe WHERE username='" + textBox1.Text + "' and pic='" + pictureBox1.Image + "'", con);
SqlDataReader dr = cmd.ExecuteReader();
int count = 0;
while (dr.Read())
{
count = count + 1;
}
if (count == 1)
{


Form fm = new Form1();
fm.Show();
this.Hide();


}
else if (count > 1)
{
MessageBox.Show("Duplicate username and pic", "login form");
}
else
{
MessageBox.Show("user name and pic is incorrect", "login form");
}
}


}

else
{

MessageBox.Show("pic is empty", "login form");
}
}




//else





// MessageBox.Show("user name empty", "login form");






catch (Exception es)
{

MessageBox.Show(es.Message);
}
}





private void button2_Click(object sender, EventArgs e)
{

OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "JPG Files(*.jpg)|*.jpg|jpg Files (*.jpg)|*.jpg";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string picloc = openFileDialog1.FileName.ToString();
textBox2.Text = picloc;
pictureBox1.ImageLocation = picloc;
}


//public MemoryStream ms { get; set; }


}
}
}
Patrice T 30-Jul-18 8:34am    
Use Improve question to update your question.
So that everyone can pay attention to this information.
Member 13847218 30-Jul-18 8:01am    
this not login
Richard MacCutchan 30-Jul-18 9:07am    
Please stop posting messages that give no information. Edit your question and provide full details of what is happening and what errors you see.
Member 13847218 31-Jul-18 7:45am    
my project login page username password image login next page..
but this coding error incorrect username password

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900