public void CargarCombos() { Utiles util = new Utiles(); DBUtil db = new DBUtil(); DataTable dt = db.consultar("select INV.InvtID, rtrim(ltrim(INV.InvtID)) + CAST(' - ' AS varchar(MAX)) + INV.descr as descr from [192.168.10.11].SoprodiUSDapp.dbo.Inventory INV INNER JOIN THX_PRODUCTOS_ACTIVOS PA on PA.cod_producto = INV.InvtID where INV.InvtID BETWEEN '0000' AND '0999' and PA.activo = 1 order by descr "); dt.Rows.Add(new Object[] { -1, "-- Seleccione --" }); CB_Productos.DataSource = dt; CB_Productos.DataTextField = "descr"; CB_Productos.DataValueField = "InvtID"; CB_Productos.DataBind(); CB_Productos.SelectedValue = "-1"; CB_Productos.Enabled = true; DataTable dt1 = db.consultar("select id, rtrim(ltrim(cod_analisis)) + CAST(' - ' AS varchar(MAX)) + nom_analisis as nombre_analisis from THX_Analisis"); dt1.Rows.Add(new Object[] { -1, "-- Seleccione --" }); CB_Analisis.DataSource = dt1; CB_Analisis.DataTextField = "nombre_analisis"; CB_Analisis.DataValueField = "id"; CB_Analisis.DataBind(); CB_Analisis.SelectedValue = "-1"; CB_Analisis.Enabled = true; DataTable dt2 = db.consultar("select id, rtrim(ltrim(cod_lab)) + CAST(' - ' AS varchar(MAX)) + nom_lab as nombre_lab from THX_LABORATORIOS"); dt2.Rows.Add(new Object[] { -1, "-- Seleccione --" }); CB_Laboratorio.DataSource = dt2; CB_Laboratorio.DataTextField = "nombre_lab"; CB_Laboratorio.DataValueField = "id"; CB_Laboratorio.DataBind(); CB_Laboratorio.SelectedValue = "-1"; CB_Laboratorio.Enabled = true; }
public void CargarComboProducto() { Utiles util = new Utiles(); DBUtil db = new DBUtil(); DataTable dt = db.consultar("select INV.InvtID, rtrim(ltrim(INV.InvtID)) + CAST(' - ' AS varchar(MAX)) + INV.descr as descr from [192.168.10.11].SoprodiUSDapp.dbo.Inventory INV INNER JOIN THX_PRODUCTOS_ACTIVOS PA on PA.cod_producto = INV.InvtID where INV.InvtID BETWEEN '0000' AND '0999' and PA.activo = 1 order by descr "); dt.Rows.Add(new Object[] { -1, "-- Seleccione --" }); dt.Rows.Add(new Object[] { -2, "-- Todos --" }); CB_Productos.DataSource = dt; CB_Productos.DataTextField = "descr"; CB_Productos.DataValueField = "InvtID"; CB_Productos.DataBind(); CB_Productos.SelectedValue = "-2"; CB_Productos.Enabled = true; //util.CargarCombo(CB_Productos, "[192.168.10.11].SoprodiUSDapp.dbo.Inventory", "InvtID", "rtrim(ltrim(InvtID)) + CAST(' - ' AS varchar(MAX)) + descr as descr", "InvtID BETWEEN '0000' AND '0999' order by descr "); ScriptManager.RegisterStartupScript(Page, this.GetType(), "temp", "<script language='javascript'>CacheItems();</script>", false); }