Select method returns rows on XP, but not Win2K?

  • Thread starter Thread starter Vagabond Software
  • Start date Start date
V

Vagabond Software

I'm at a complete loss on this problem. I'm using a DataColumn Expression with the DataTable Select method to return rows matching a data. Rows are returned on my Windows XP Professional computer at home, but no rows are found on the client's Windows 2000 computers.

I have checked the regional settings' date format on both machines, and they are identical. The expression used in both locations are identical, and the data used in both locations are identical.

Here is the code:

01: string expr = "FileName LIKE '" + pattern + "*'";
02: string latestFileDate;
03: latestFileDate = dtFiles.Compute("MAX(LastModified)", expr).ToString();
04: expr = expr + " AND LastModified = #" + latestFileDate + "#";
05: DataRow[] foundRows = dtFiles.Select(expr);
06: string latestFile = foundRows[0]["FullPath"].ToString();

DataTable dtFiles contains a list of files with information in four columns; FileName, FileSize, LastModified, and FullFilename (includes path). Let's say the files are all files with the ".log" extension. Let's say string pattern equals "KB".

String expr is first used on line 03 to obtain the last date and time any log file beginning with "KB" was modified.

On line 04, I append the computed date and time onto String expr as an additional filter on the LastModified column.

Line 05 ALWAYS returns one row at home, on Windows XP, but no rows are returned on the client's Windows 2000 computers. String expr is identical on Line 04, on both computers.

Any help is greatly appreciated.

- carl
 
If my following suggestion works for you, please let me know. I was having a
similar problem. If it works for you, you'll no doubt be as confused as I was
when it worked for me.

Before line 05, insert the following as a new line:

dtFiles.Select("FileName = '1' ")

OK, as you can see, this line of code effectively does NOTHING meaningful to
the overall output. But run it and let me know if line 05 returns the correct
info now.

Good Luck! (It worked for me... but don't ask me why.)
 
Unfortunately, that did not fix the problem. Thank you for your suggestion. I am willing to try anything at this point.

- carl

Tom Markham said:
If my following suggestion works for you, please let me know. I was having a
similar problem. If it works for you, you'll no doubt be as confused as I was
when it worked for me.

Before line 05, insert the following as a new line:

dtFiles.Select("FileName = '1' ")

OK, as you can see, this line of code effectively does NOTHING meaningful to
the overall output. But run it and let me know if line 05 returns the correct
info now.

Good Luck! (It worked for me... but don't ask me why.)


Vagabond Software said:
I'm at a complete loss on this problem. I'm using a DataColumn Expression with the DataTable Select method to return rows matching a data. Rows are returned on my Windows XP Professional computer at home, but no rows are found on the client's Windows 2000 computers.

I have checked the regional settings' date format on both machines, and they are identical. The expression used in both locations are identical, and the data used in both locations are identical.

Here is the code:

01: string expr = "FileName LIKE '" + pattern + "*'";
02: string latestFileDate;
03: latestFileDate = dtFiles.Compute("MAX(LastModified)", expr).ToString();
04: expr = expr + " AND LastModified = #" + latestFileDate + "#";
05: DataRow[] foundRows = dtFiles.Select(expr);
06: string latestFile = foundRows[0]["FullPath"].ToString();

DataTable dtFiles contains a list of files with information in four columns; FileName, FileSize, LastModified, and FullFilename (includes path). Let's say the files are all files with the ".log" extension. Let's say string pattern equals "KB".

String expr is first used on line 03 to obtain the last date and time any log file beginning with "KB" was modified.

On line 04, I append the computed date and time onto String expr as an additional filter on the LastModified column.

Line 05 ALWAYS returns one row at home, on Windows XP, but no rows are returned on the client's Windows 2000 computers. String expr is identical on Line 04, on both computers.

Any help is greatly appreciated.

- carl
 
Back
Top