System.ArgumentException: 'Unsupported keyword:' metadata '.'

0

How do I solve the error?

  

System.ArgumentException: 'Unsupported keyword:' metadata '.'

which tells me the line conec = new SqlConnection(conexion);

This is the complete code:

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace ProyectoDicar.Models
{
public class gestionUsuario
{
    private SqlConnection conec;

    private void Conectar()
    {
        string conexion = 
ConfigurationManager.ConnectionStrings["SidcarEntities"].ToString();
        conec = new SqlConnection(conexion);
    }

    public int Borrar(int codigo)
    {
        Conectar();
        SqlCommand comando = new SqlCommand("delete from articulos where 
codigo=@codigo", conec);
        comando.Parameters.Add("@codigo", SqlDbType.Int);
        comando.Parameters["@codigo"].Value = codigo;
        conec.Open();
        int i = comando.ExecuteNonQuery();
        conec.Close();
        return i;
    }    

}
}
    
asked by Jager Rubio 17.05.2018 в 23:52
source

0 answers