using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Login.Models;
using System.Data.SqlClient;
namespace Login.Controllers
{
public class ContaController : Controller
{
SqlConnection conexao = new SqlConnection();
SqlCommand com = new SqlCommand();
SqlDataReader dr;
// GET: Conta
[HttpGet]
public ActionResult Login()
{
return View();
}
void connectionString()
{
conexao.ConnectionString = “Data Source=ISMAEL-PC;Initial Catalog=ACESSO;Integrated Security=True;”;
}
[HttpPost]
public ActionResult Verificar(Conta conta)
{
connectionString();
conexao.Open();
com.Connection = conexao;
com.CommandText = " select * from LOGINS where usuario=’"+conta.Usuario+ “’ and senha’”+conta.Senha + “’”;
dr = com.ExecuteReader();
if (dr.Read())
{
conexao.Close();
return View(“PaginaInicial”);
}
else
{
conexao.Close();
return View(“Erro”);
}
}
}
}
Da dando erro na linha 33 dr = com.ExecuteReader(); Não sei o por que, fiz a partir de um tutorial gringo