Keyword not supported: 'provider'. Opening SqlConnection
Aleksey Mynkov has it right. But here is more detail since you are needing more clarification.
Your web.config is fine. The auto-generated Visual Studios connection string is using the right setup. Instead, on your webform1 file you need to do 2 things.
Add
using System.Data.OleDb.OleDbConnection;
to the top of your file, and remove theusing System.Data.SqlConnection;
Change your webform1 code to be:
private static string conDB = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; protected void Page_Load(object sender, EventArgs e) { using (OleDbConnection con = new OleDbConnection(conDB)) //here is the error { } }
You should use System.Data.OleDb.OleDbConnection
.
I know this is somewhat an old thread and already answered but i'm adding my solution for future reference
I have SQL server 11.0 database, and i encountered the error when i was trying to work with it in SharePoint app, I haven't tried the other proposed answers, but i simply just deleted the "Provider" portion (and reordered) , so my connection string which looked like this:
Provider=SQLOLEDB.1;Password=DBPassword;Persist Security Info=True;User ID=sa;Initial Catalog=DBName;Data Source=DBServer
Now looks like this:
Data Source=DBServer;Initial Catalog=DBName;Persist Security Info=True;User ID=sa;Password=DBPassword;
And it worked just fine