private string find_current_stock() { string current; DataTable dt = Select_Logic.Find_Stock("select_tbl_stock_sp_give_sub_cat_id", ddl_sub_category_name.SelectedValue.ToString()); try { current = dt.Rows[0][2].ToString(); } catch (IndexOutOfRangeException e) { current = "0";//new product so stock =0 } return(current); }