“Тайм -аут выполнения истек. Период времени ожидания, прошедший до завершения операции, или сервер не отвечает” Ответ

Тайм -аут выполнения истек срок действия тайм -аута

using (SqlCommand sqlCmd = new SqlCommand(sqlQueryString, sqlConnection))
   {
      sqlCmd.CommandTimeout = 0; // 0 = give it as much time as it needs to complete
      ...
    }
Coder Kadir

Тайм -аут выполнения истек. Период времени ожидания, прошедший до завершения операции, или сервер не отвечает

// If your query needs more than the default 30 seconds, 
// you might want to set the CommandTimeout higher. 
// To do that you'll change it after you instantiated the DataAdapter on the SelectCommand 
// property of that instance, like so:

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";
}

// The other option: is to address your query. In Sql Server you can analyze 
// the execution plan. I bet there is a full-table scan in it. 
// You might experiment with adding an index on one or two columns in your [old] 
// and [new] table. Keep in mind that adding indexes comes at the cost of higher execution 
// times for inserts and updates and space requirements.
Mappy Show

Ответы похожие на “Тайм -аут выполнения истек. Период времени ожидания, прошедший до завершения операции, или сервер не отвечает”

Вопросы похожие на “Тайм -аут выполнения истек. Период времени ожидания, прошедший до завершения операции, или сервер не отвечает”

Больше похожих ответов на “Тайм -аут выполнения истек. Период времени ожидания, прошедший до завершения операции, или сервер не отвечает” по C#

Смотреть популярные ответы по языку

Смотреть другие языки программирования