elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: (TUTORIAL) Aprende a emular Sentinel Dongle By Yapis


  Mostrar Temas
Páginas: [1]
1  Programación / .NET (C#, VB.NET, ASP) / Necesito ayuda con este error!!! en C# en: 1 Julio 2015, 17:20 pm
Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Data.SqlClient;
  7. using System.Configuration;
  8.  
  9. namespace Presentacion
  10. {
  11.    class Clase_Personal
  12.    {
  13.                private SqlConnection conn;
  14.        private SqlDataReader Reader;
  15.  
  16.        public bool ValidarUsuario(string usuario,string clave)
  17.        {
  18.            bool existe = false;
  19.            int i = 0;
  20.  
  21.            conn = new SqlConnection(ConfigurationManager.ConnectionStrings["PROYFINAL901.Properties.Settings.Setting"].ToString());
  22.            using (SqlCommand cmd = new SqlCommand("VALIDARUSUARIO", conn))
  23.            {
  24.                try
  25.                {
  26.                    cmd.CommandType = CommandType.StoredProcedure;
  27.                    cmd.Connection.Open();
  28.                    cmd.Parameters.AddWithValue("@USU", usuario);
  29.                    cmd.Parameters.AddWithValue("@Cla", clave);
  30.  
  31.                    Reader = cmd.ExecuteReader();
  32.  
  33.                    while (Reader.Read())
  34.                    {
  35.                        i++;
  36.                    }
  37.  
  38.                    if (i >= 1) { existe = true; }
  39.                    else { existe = false; }
  40.                }
  41.                catch (Exception ex)
  42.                {
  43.                    throw ex;
  44.                }
  45.                finally
  46.                {
  47.                    Reader.Close();
  48.                    cmd.Connection.Close();
  49.                }
  50.                return existe;
  51.            }
  52.        }
  53.    }
  54. }
  55.  
y al final me da el siguiente error

" CommandType " no existe en el contexto actual.... Necesito saber a que se debe esto!


Mod: El titulo debe ser descriptivo, el código debe ir enetiquetas GeSHi, el problema debe ir en el subforo de su lenguaje especifico
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines