I was trying to add data from a database to acombobox.
try
{
SqlCeCommand com = new SqlCeCommand(\"select * from Category_Master\
Your column doesn't seem to have type int. To avoid things like this, you can use the columnnames instead of indexes.
try
{
SqlCeCommand com = new SqlCeCommand("select * from Category_Master", con);
SqlCeDataReader dr = com.ExecuteReader();
while(dr.Read()){
string name = dr["yourColumnName"].ToString();
cmbProductCategory.Items.Add(name);
}
}
catch(Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message, System.Windows.Forms.Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}