View Full Version : Hey all plz i need help..someone plz check with me this code and my logic

14-02-2009, 01:40 PM
i'm making a program that copmares between a folder contained pictures and an excel sheet that have the picture names...the idea is that the folder have the same pictures repeated but with a differnt name...i'm using w atool in .net framework named MD5 that encrypt all photos and return to me a 32 digit..that will be unique and through it i will be able to compare between all photos no matter how different are their names.
First i compared between the 2 main things...excel sheet and my folder..if the xsl sheet contains a name exists in my folder...do the md5 thing comparison
but the problem here is that my code deosn't return any thing..the code of comparing between both xsl and folder
#region compare xsl & new folder
string[] Files= Directory.GetFiles("C:\\Users\\Muca\\Pictures\\New Folder");
PhotoConnection = newOleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\\Muca\\Pictures\\Tesr.xls;Extende d Properties=Excel 8.0");
PhotoCommand = newOleDbCommand(
"select Singer from [Sheet1$]where Singer like '%" + Files + "%'"
, PhotoConnection);
OleDbDataReader reader = PhotoCommand.ExecuteReader();
while (reader.Read())
if (reader["Singer"].ToString().Contains(Files.ToString()))

please anyone can help do not hesitate reponding here or at my e-mail at yahoo as soon as possible
thanx alot in advance

Mohamed Fouad
14-02-2009, 07:27 PM
Dear MucaMucam,
I hope that you will have the right advice!

15-02-2009, 07:16 PM
dear MucaMucam

i think u have to write the path with one backslash " / " not double "// "

, may be this work with u

actually i dont know other wrong in this code

but make sure after each i/o operation that it's done correctly by simple if statment

02-04-2009, 03:14 PM
try this ......

bool flag=false;
while (reader.Read())

foreach(string s in Files)
if (reader["Singer"].ToString()==s )
// true


// do any thing


Mohamed Fouad
02-04-2009, 08:33 PM
Thanks Moldfox for help

17-09-2011, 02:32 PM
thank you for your sharing, it is so useful to me.