Hi all.
I have googled for this error and saw some people having it,
but no deccent solution. This problem happens even with static
queries, as no matter what, table MUST be returned. So, i
wanted to track the problem by writing text log, but when i
started to write to text log the problem gone... I removed the
code of keeping the error log, and the problem occured again...
and so on and on for 2 days now. Here is the function with no log,
that fails:
Note: this function is a part from class and variables like lastError or date
defined in it.
public bool ExecuteManualQuery(string query)
{
bool flag = true;
try
data = new DataSet();
OpenConnection();
SqlDataAdapter da = new SqlDataAdapter(query, conn);
da.Fill(data);
if (data.Tables.Count == 0)
flag = false;
lastError = Properties.Resources.ERR_NO_TBL;
}
else if (data.Tables[0].Rows.Count == 0)
lastError = Properties.Resources.ERR_NO_ROW;
catch (Exception ex)
lastError = ex.Message;
GC.Collect();
return flag;
And here is the same function, with logging that (for some wierd and
strange reason) does work:
//******** TESTING BLOCK START*******\\
System.IO.TextWriter tw = new System.IO.StreamWriter("C:\\test.log", true);
tw.WriteLine("-----" + DateTime.Now.ToShortTimeString() + "-----");
tw.WriteLine(DateTime.Now.ToShortTimeString() + " - Query: " + query);
//******** TESTING BLOCK END *******\\
tw.Close();
Maybe it's function runtime issue? If anyone can help, please do.
Thanks in advanced!