Отображение данных в datagridview из базы данных вместе с combobox
Привет, я пытаюсь заполнить данные в datagridview, который также содержит datagridviewcombobox, и я использовал хранимую процедуру для извлечения данных из хранимой процедуры.
Мой код таков
void Show_customer_bills_Details() { connection(); SqlCommand cmd = new SqlCommand("Bill_Search_Details", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@invno", editdetails); SqlDataAdapter adp = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); adp.Fill(dt); DataRow dr = dt.NewRow(); //con.Close(); int count = dt.Rows.Count; for (int i=0;i<count;i++) { ="" dt.importrow(dr); ="" grdsearch.rows[i].cells["item_description"].value="dt.Rows[i]["Item_Description"].ToString(); " grdsearch.rows[i].cells["hsn_code"].value="dt.Rows[i]["HSN_Code"].ToString(); " grdsearch.rows[i].cells["quantity"].value="dt.Rows[i]["Quantity"].ToString(); " grdsearch.rows[i].cells["converstion_type"].value="dt.Rows[i]["Converstion_Type"].ToString(); " grdsearch.rows[i].cells["rate"].value="dt.Rows[i]["Rate"].ToString(); " grdsearch.rows[i].cells["amount"].value="dt.Rows[i]["Amount"].ToString(); " grdsearch.rows[i].cells["unit_type"].value="dt.Rows[i]["Unit_Type"].ToString(); " }<="" b="">
И Я ПОЛУЧАЮ ОШИБКУ
'Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index'
Что я уже пробовал:
ранее я использовал
dt.Rows.Add(dr);
я получил ошибку
'This row already belongs to this table.'
тогда я попробовал
dt.ImportRow(dr);
я получил ошибку :
'Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index'
пожалуйста, помогите мне...