views:

289

answers:

2

I have a windows service connecting to a SqlServer database on the local box. This works fine most all the time. At a large customer, however, the database connectivity gets corrupted for some rare and unknown reason. When this happens, calls to DbDataAdapter.Fill return a DataSet with a different number of columns than in the select command passed in (validated by trace logs showing the sql expected, and the number of columns returned). For the first few errored DataSets it appears the adapter instance is returning results from the previous query. This is happening even though the adapter objects are unique instances, and the connection/adapter creation calls are thread protected (as DbProviderFactory is not thread safe).

Has anyone experience this or something similar? Does anyone know what could cause this? At this moment in time, I'm having a hard time thinking up new ideas for a cause of this.

A: 

Are you filling a strongly-typed dataset (STDS)? If you are filling an STDS, if the column names and types do not match up, you will get tables with some phantom columns... namely those that were defined in the schema of the STDS, and not in your returned recordset.

Jeff Fritz
No, it's not strongly typed. It's just a new DataSet()
Jon Ediger
A: 

Try turning connection pooling off for a while, see if that eases the problem. I have seen this question asked somewhere else, I think connection pooling was involved but I can't be sure. I'll see if I can find the other forum, or maybe someone else remembers it as well?

pipTheGeek
I am very interested in that link, if you can find it or help me to find it via search ideas. I've been trying to find if it is a connection pool issue so I can be more confident in my current idea to resolve the issue. Thanks.
Jon Ediger
Accepting answer at the moment, as it follows along with issues others at my company have experienced. Will re-open should it not pan out.
Jon Ediger