Exemplo n.º 1
0
        /*
         * [HttpPost]
         * public ActionResult FileUpload(HttpPostedFileBase file)
         * {
         * if (file != null)
         * {
         * byte[] array;
         * StringBuilder lsbQuery = new StringBuilder();
         *
         * // file is uploaded
         *
         * // save the image path path to the database or you can send image
         * // directly to database
         * // in-case if you want to store byte[] ie. for DB
         * using (MemoryStream ms = new MemoryStream())
         * {
         *  file.InputStream.CopyTo(ms);
         *  array = ms.GetBuffer();
         *  lsbQuery.Append(@"insert into imagenes(vbImagen) values (convert(varbinary, '");
         *  foreach(var value in array)
         *  {
         *      lsbQuery.Append(value);
         *  }
         *  lsbQuery.Append(@" '))");
         * }
         *
         *
         * Conneccion.Execute(lsbQuery);
         * }
         * // after successfully uploading redirect the user
         * return RedirectToAction("Index", "Home");
         * }
         */
        public ActionResult ConsultarImagenes()
        {
            StringBuilder lsbQuery = new StringBuilder();
            DataTable     valores  = new DataTable();

            lsbQuery.Append("select * from registros r inner join usuarios u on r.iCodUsuario = u.iCodUsuario");
            ViewBag.valores = Conneccion.ExecuteDataTable(lsbQuery);
            return(View());
        }
Exemplo n.º 2
0
        public ActionResult Consultar()
        {
            StringBuilder lsbQuery = new StringBuilder();
            DataTable     valores  = new DataTable();

            lsbQuery.Append("select r.iCodRegistro, case isnull(r.iCodUsuario, -1) when -1 then 'No identificado' else u.vchNombre end as vchNombre, getdate(), cast(r.bValido as tinyint)");
            lsbQuery.Append("from registros r ");
            lsbQuery.AppendLine("left join usuarios u on r.iCodUsuario = u.iCodUsuario");
            ViewBag.valores = Conneccion.ExecuteDataTable(lsbQuery);
            return(View());
        }