i want to assign two combobox to grid
i am trying and trying assign multiple combobox to grid
i want to assign item_name and item_category combobox to grid
please help
Code
public Form1()
{
InitializeComponent();
using (SqlConnection conn = new SqlConnection("Data Source=0000;Initial Catalog=test;User Id = 0;Password = 0;Integrated Security=false;"))
{
SqlCommand sqlComm = new SqlCommand("get_ItemDataFill", conn);
sqlComm.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = sqlComm;
DataTable result = new DataTable();
da.Fill(result);
cmbItemName.DataSource = result;
cmbItemName.ValueMember = "ITEM_CODE";
cmbItemName.DisplayMember = "ITEM_NAME";
cmbItemCategory.DataSource = result;
cmbItemCategory.ValueMember = "ITEM_CATEGORY";
cmbItemCategory.DisplayMember = "ITEM_CATEGORY";
//dataGridView1.
//DataGridViewComboBoxColumn dgvChb = new DataGridViewComboBoxColumn();
//dgvChb.HeaderText = "ITEM_CODE";
//dgvChb.Items.Add(result);
//dataGridView1.Columns.Add(dgvChb);
}
}
store procedure
CREATE PROCEDURE get_ItemDataFill
AS
BEGIN
select ITEM_CODE,
ITEM_NAME,
ITEM_CATEGORY
from ITEM_MASTER
END
GO
output
ITEM_CODE ITEM_NAME ITEM_CATEGORY
1 AAA A
2 BBBB B
3 CCC C
