public DataSet prno_combo(SqlCommand cmd) { DataSet ds = new DataSet(); getcon(); cmd.Connection = getcon(); SqlDataAdapter adapt = new SqlDataAdapter(cmd); adapt.Fill(ds, "Purchase"); DataRow dr = ds.Tables[0].NewRow(); dr["Id"] = "Select"; dr["Id"] = "0"; ds.Tables[0].Rows.InsertAt(dr, 0); return ds; } public DataSet store_combo(SqlCommand cmd) { DataSet ds = new DataSet(); getcon(); cmd.Connection = getcon(); SqlDataAdapter adapt = new SqlDataAdapter(cmd); adapt.Fill(ds, "StoreMaster"); DataRow dr = ds.Tables[0].NewRow(); dr["StoreName"] = "Select"; dr["id"] = "0"; ds.Tables[0].Rows.InsertAt(dr, 0); return ds; }
public DataSet BL_prno_combo(clsPRml mlprobj) { SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "Prc_BindPurchaseMandate"; return dlprobj.prno_combo(cmd); } public DataSet BL_store_combo(clsPRml mlprobj) { SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "Prc_BindStore"; return dlprobj.store_combo(cmd);
public void BindPRnoCombo() { cbPRNo.DataSource = blprobj.BL_prno_combo(mlprobj).Tables[0]; cbPRNo.ValueMember = "Id"; cbPRNo.DisplayMember = "Id"; cbPRNo.SelectedIndex = 0; } public void BindStoreCombo() { // ERROR OCCURS HERE cbStore.DataSource = blprobj.BL_store_combo(mlprobj).Tables[0]; cbStore.ValueMember = "Id"; cbStore.DisplayMember = "StoreName"; cbStore.SelectedIndex = 0;
if(ds!=null && ds.Tables.Count > 0){ //code here }
if(dt!=null && dt.Rows.Count > 0){ //code here }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)