Hello;

I am have written a few lines of programming code that returned data from a SQLBase database. This code has been running successfully without fail up until yesterday afternoon. No changes has been done to it, but the program now crashes with an Time Out Error on the OleDBDataAdaptor.fill method. The data returned for the SQL query is only 2rows and 10Columns. I am quite baffled as to what may have caused this.

protected IList<T> GenericGetAll<T>(string sql, string key, ObjectGenerator<T> generator)
        {
           

            OleDbCommand command = new OleDbCommand(sql, conn);//, trans);
            //command.Parameters.Add(new OleDbParameter("bor_bar_no", key));
            DataTable table = ExecuteDataTable(command,key);
            List<T> entities = new List<T>();
            //foreach (DataRow row in table.Rows)
            foreach(DataRow row in table.rows)
            {
                entities.Add(generator(row));
            }
            return entities;

protected DataTable ExecuteDataTable(OleDbCommand command, string key)
        {
            DataTable dataTable = new DataTable();
            para = new OleDbParameter();
            para.Value = key;
            command.Parameters.Add(para);
            OleDbDataAdapter oleDbDA = new OleDbDataAdapter(command);
                oleDbDA.Fill(dataTable);
           
            return dataTable;
}

Dani AI

Generated

described a sudden timeout on OleDbDataAdapter.Fill even though the result set is tiny. suggested a rebuild (unlikely to help runtime timeouts) and rightly raised blocking/locks on the server. Two practical issues to keep in mind: the client-side timeout only tells when the client stopped waiting, not why the server stopped responding; and the ADO.NET/OleDb parameter model and connection handling frequently cause surprising hangs when used incorrectly.

Likely causes (ranked): database-side blocking or long-running locks (transactions left open, maintenance, or a changed execution plan), incorrect parameter usage for the OLE DB provider (positional parameters, missing types/sizes), unclosed/long-lived connections or DataReaders exhausting the pool, and network/provider problems or recent server/provider configuration changes. Note: the post mentions SQLBase but the thread tags say SQL Server — diagnostics commands/tools differ by engine.

Immediate steps and a small pattern to try (set a conservative timeout, give the provider a properly typed parameter, and ensure disposal):

using (var cmd = new OleDbCommand(sql, conn))
{
    cmd.CommandTimeout = 60; // seconds (default is 30)
    cmd.Parameters.Add("bor_bar_no", OleDbType.VarChar, 50).Value = key;
    using (var adapter = new OleDbDataAdapter(cmd))
    {
        adapter.Fill(table);
    }
}

Diagnostics checklist: run the exact SQL and parameter in a DB client to measure server time; inspect server-side sessions for blocking (sp_who2/Activity Monitor on SQL Server, or the equivalent for SQLBase); temporarily raise the command timeout to see if the query eventually completes; enable provider/connection tracing and check event logs; confirm no uncommitted transactions or lingering DataReaders on the same connection. For reference on the command timeout property see OleDbCommand.CommandTimeout.

Recommended Answers

All 2 Replies

i think you have to clean and build solution again .


Krishna Bhanu

How many users are we talking about here and what is the back end database? For example if this application has a large number of users and is powered by MSSQL you could have a problem with locks in your database. If five users request a table lock then the second user will have to wait for the first user, and the third will wait for the second, etc. Anyone that waits in line for longer than the timeout will receive this exception.

Provider a little more information on your database and post your query.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.