Click here to Skip to main content
15,903,856 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my code for combo box is as fallow
C#
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
           try
           {
                button1.Enabled = true;
                button2.Enabled = true;
                button3.Enabled = true;
                textBox1.Enabled = false;

                myCon.Open();
                //int i = Convert.ToInt32(comboBox1.SelectedItem);
                //String i = comboBox1.SelectedItem.ToString();

                string sss = "select * from property where propno='" + comboBox1.SelectedItem.ToString() + "'";
                //Console.WriteLine(sss);

                OleDbCommand cmld = new OleDbCommand(sss, myCon);

                OleDbDataReader drsl = cmld.ExecuteReader();
                drsl.Read();

                textBox1.Text = drsl[0].ToString();
                textBox2.Text = drsl[1].ToString();
                textBox3.Text = drsl[2].ToString();
                textBox4.Text = drsl[3].ToString();
                textBox5.Text = drsl[4].ToString();
                comboBox2.Text = drsl[5].ToString();
                label9.Text=drsl[8].ToString();
                pictureBox1.Image = Image.FromFile(label9.Text);
                label10.Text=drsl[9].ToString();
                pictureBox2.Image = Image.FromFile(label10.Text);
                label11.Text=drsl[10].ToString();
                pictureBox3.Image = Image.FromFile(label11.Text);

                drsl.Close();
                myCon.Close();
                    

                  


                


           }
           catch (Exception ex) 
           {
            MessageBox.Show(ex.Message.ToString(), "Real Estate...    ", MessageBoxButtons.OK, MessageBoxIcon.Error); 
         }
        }



The error is Data type missmatch in criteria expression , what is it & what is Criteria expression . .
Posted
Comments
abbaspirmoradi 5-Oct-13 7:07am    
debug your code line by line and get number of line that give this error..
Raghavendra M 5-Oct-13 7:07am    
how to debug line by line
Shubh Agrahari 5-Oct-13 7:10am    
putting break point you can major your code line by line...

hello friend

I think that you're not passing your parameters correct probably the propno should be numeric like Int type and you are passing it as String

so review again about your Data Types.........between DB Table columns and your front code

hope it will help you


Happy to help!!!
 
Share this answer
 
Comments
Raghavendra M 5-Oct-13 7:47am    
no i m not getting , now i changed as ,

int i = Convert.ToInt32(comboBox1.SelectedItem.ToString());
//String i = comboBox1.SelectedItem.ToString();

string sss = "select * from property where propno='" + i + "'";
Shubh Agrahari 5-Oct-13 7:51am    
then now what happening ..???
Raghavendra M 5-Oct-13 8:05am    
then also same error . .
string sss = "select * from property where propno=" + comboBox1.SelectedItem.ToString() + "";
 
Share this answer
 
Comments
Raghavendra M 12-Oct-13 10:33am    
Thank u . . .
 
Share this answer
 

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