error - unable to find requested .net framework data provider

I have found plenty of information on this subject on stack overflow as well as on the web but none of it seems to help.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;


namespace GeoCode.Models
{
    public class address
    {
     [Key]
     public int ARENA_ID { get; set; }
     public string ADDRESS1 { get; set; }
     public string CITY { get; set; }
     public string ZIP { get; set; }
     public decimal COUNTRY { get; set; }

 }

 public class latlng
 {
     [Key]
     public int ARENA_ID { get; set; }
     public string LAT { get; set; }
     public string LNG { get; set; }
 }

 public class GeoCodeDBContext : DbContext
 {
     public DbSet<address> WEB_ARENA { get; set; }
     public DbSet<latlng> WEB_ARENA_GEO { get; set; }
 }
}

And when I use this model to create a class with read/write actions and views using entity framework I get the error, "unable to find requested .net framework data provider. It may not be installed."

My connection string is:

 <add name="GeoCodeDBContext"
 connectionString="server=********;database=*****;uid=*****;pwd=******"
 providerName="System.Data.SqlServer"/>

Upvotes: 0

Views: 89

Answers (2)

DavidG
DavidG

Reputation: 118937

You have specified the wrong provider in your connection string. System.Data.SqlServer is not a provider. Try this instead:

<add name="GeoCodeDBContext"
     connectionString="..."
     providerName="System.Data.SqlClient"/>

Upvotes: 1

Patrick Hofman
Patrick Hofman

Reputation: 156898

The provider providerName="System.Data.SqlServer" does not exist. It should be providerName="System.Data.SqlClient".

See the documentation on ProviderName. It might be nice to know that System.Data.SqlClient is actually the default value, so you don't even need to provide a value for providerName.

Upvotes: 2

Related Questions