combobox item adding

Jan 30 2010 6:44 AM

hey all...i have a problem when i try to add item to combobox..i have a combobox in my form which is named as cmbfirma...and i fill it with a column from my database....and i want user to add new firm if there is no exist in database...and for that i used the code below
cmd.Parameters.AddWithValue("@firma",cmbFirma.SelectedItem.ToString());
and here it writes to the database as System.Data.DataRowView...and i tried to another code below
cmd.Parameters.AddWithValue("@firma",cmbFirma.SelectedValue.ToString());
but this time it writes database normally but if i want to add new firm from txt file it gives error...and it says "Unable to set an object reference to an instance object"
what can i do to get rid off here ??

Answers (3)