G
Guest
void CreateBatches(string currDir, DataTable hvTable) {
string id;
DirectoryInfo di = new DirectoryInfo(currDir);
StreamWriter writer = new StreamWriter(currDir + "\\Index.dat", false);
DataRow[] rows;
string tmpS;
int i = 0;
foreach (FileInfo fi in di.GetFiles("*.tmp"))
{
id = fi.Name.Remove(fi.Name.IndexOf('.'));
rows = hvTable.Select("filename=" + id);
I am using C# to make sure that a seelcted file exists in a datable before i
write its data into a file, but in the code above it crashes at the last
line. The error i get is "Could not find column [value of id]." If I put the
same string, by hardcoding id, it works. What am I doing wrong?
string id;
DirectoryInfo di = new DirectoryInfo(currDir);
StreamWriter writer = new StreamWriter(currDir + "\\Index.dat", false);
DataRow[] rows;
string tmpS;
int i = 0;
foreach (FileInfo fi in di.GetFiles("*.tmp"))
{
id = fi.Name.Remove(fi.Name.IndexOf('.'));
rows = hvTable.Select("filename=" + id);
I am using C# to make sure that a seelcted file exists in a datable before i
write its data into a file, but in the code above it crashes at the last
line. The error i get is "Could not find column [value of id]." If I put the
same string, by hardcoding id, it works. What am I doing wrong?