Answers for "transaction commit exception system.data.sqlclient.sqlexception (0x80131904): execution timeout expired. the timeout period elapsed prior to completion of the operation or the server is not responding."

SQL
0

System.Data.SqlClient.SqlException: 'Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.' SqlDataAdapter

private void FillInDataGrid(string SQLstring)
{
    string cn = ConfigurationManager.ConnectionStrings["Scratchpad"].ConnectionString; //hier wordt de databasestring opgehaald
    DataSet ds = new DataSet();
    // dispose objects that implement IDisposable
    using(SqlConnection myConnection = new SqlConnection(cn))
    {
        SqlDataAdapter dataadapter = new SqlDataAdapter(SQLstring, myConnection);

        // set the CommandTimeout
        dataadapter.SelectCommand.CommandTimeout = 60;  // seconds

        myConnection.Open();
        dataadapter.Fill(ds, "Authors_table"); 
    }
    dataGridView1.DataSource = ds;
    dataGridView1.DataMember = "Authors_table";
}
Posted by: Guest on February-03-2021

Code answers related to "transaction commit exception system.data.sqlclient.sqlexception (0x80131904): execution timeout expired. the timeout period elapsed prior to completion of the operation or the server is not responding."

Code answers related to "SQL"

Browse Popular Code Answers by Language