Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'MultipleActiveResultsSets' Keyword Not Supported

I am trying to read from an SQL Server database which is hosted on MS Azure, through an ASP.NET WebForms website created in Visual Studio 2013.

I've stored the Connection String in Web.Config, and have referenced it in my Code-Behind.

However, when I try to run Default.aspx locally, this error is displayed.

Here is my Web.Config:

  <connectionStrings>
     <add name="FYPConnectionString1" 
     connectionString="Data Source=damo.database.windows.net‌​;Initial Catalog=Ballinora_db;         
     Persist Security Info=True; User ID={Username};Password={Password};" />
  </connectionStrings>

I removed "MultipleActiveResultsSets=False" from the Connection String to see if the error stopped, but instead, the error now displays for "Encrypt".

So the error is appearing for the next item after the Password part of the connection string. Would the password have anything to do with the problem?

Also, this username and password which are required, are they the Server Admin Login details which appear in the Azure portal?

Here is the Code-Behind also:

private void bindRepeater()
{
    string constr = ConfigurationManager.ConnectionStrings["FYPConnectionString1"].ConnectionString;  
    //-- assuming Azure connection string stored in ConnectionString config in Web.Config as YourConnString 
    using (SqlConnection con = new SqlConnection(constr))
    {
        using (SqlCommand cmd = new SqlCommand("SELECT Name FROM Users", con))
        {
            cmd.CommandType = CommandType.Text;
            con.Open();
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            DataTable dt = new DataTable();
            sda.Fill(dt);
            repTest.DataSource = dt;
            repTest.DataBind();
            con.Close();
        }
    }
}

protected void btnDisplay_Click(object sender, EventArgs e)
{
    this.bindRepeater();
}
like image 364
user7554035 Avatar asked Feb 15 '17 11:02

user7554035


2 Answers

You mistyped "MultipleActiveResultsSets". The "Result" in it is not plural.

Correct way: "MultipleActiveResultSets".

like image 79
KOB Avatar answered Nov 18 '22 20:11

KOB


Note for others finding this question: This can also happen if you forget to choose the proper Type (data provider) in the Azure configuration for the connection string. It happened for me with MySQL selected instead of SQLAzure. Since the keyword isn't on that provider it causes an error.

enter image description here

like image 42
IronSean Avatar answered Nov 18 '22 21:11

IronSean