I was trying to add data from a database to acombobox.
try
{
SqlCeCommand com = new SqlCeCommand(\"select * from Category_Master\
Ok OK. Its solved....
Here is the code..
try
{
SqlCeCommand com = new SqlCeCommand("select CategoryName from Category_Master", con);
SqlCeDataReader dr = com.ExecuteReader();
while(dr.Read()){
string name = dr.GetString(0);
cmbProductCategory.Items.Add(name);
}
}
catch(Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message, System.Windows.Forms.Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
I changed the sqlcommand to a single value and changed column number for dr.getstring() to 0.. it worked. Thank you guys for the help.. I expect more because i am only half way in my project..