public void SendRoomIDtoCheckINNew(int RID)
{
try
{
object[,] ParamArray = new object[,] { { "@RoomID", RID } };
DataSet ds = new DataSet();
ds = DB.ExecuteQuery_SP("SelectRoomDetailsForGridByID", ParamArray);
if (ds.Tables.Count > 0)
{
cmbroomcat.DataSource = ds.Tables[0];
cmbroomcat.Text = ds.Tables[0].Rows[0]["RoomCategoryName"].ToString();
cmbroomno.DataSource = ds.Tables[0];
cmbroomno.DisplayMember = ds.Tables[0].Rows[0]["RoomNo"].ToString();
cmbroomno.Text = ds.Tables[0].Rows[0]["RoomNo"].ToString();
//cmbroomno.ValueMember = ds.Tables[0].Rows[0]["RoomID"].ToString();
txtCapacity.Text= ds.Tables[0].Rows[0]["RoomCapacity"].ToString();
}
}
catch (Exception ex) { ex.ToString(); }
}
above is my code but when i try to bind dt object to respective combo box and textbox it is not binding what is the reason behing it i am still confussing

mohammed shamsheerPosted Sep 30, 2014, 8:21 AM
cmbroomcat1.SelectedIndex = -1;
Arunava BhattacharjeePosted Sep 30, 2014, 6:41 AM
public DataTableCollection Tables { get; }
mohammed shamsheerPosted Sep 30, 2014, 5:50 AM
Munesh SharmaPosted Sep 30, 2014, 5:43 AM
Arunava BhattacharjeePosted Sep 30, 2014, 5:24 AM
Check this post in c-sharp corner :
http://www.c-sharpcorner.com/UploadFile/0f68f2/programmatically-binding-datasource-to-combobox-in-multiple/
Your problem is table returns a DataSetCollection where DataSource expects an Enumerable. So its a type mismatch.
Also try to bind the parameter to CommandParameter, search in Google about SQL Injection. If this post helps you then please mark the answer as accepted.