TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Hasibul Kamel
NA
44
4.2k
compare file in database
Aug 17 2020 11:05 PM
Hi, I have a system that can save and read CSV files and store the records in the database.
The problem is how to compare if the file already save in database. If there is a new file, the system will save the file name and last write time.
foreach (FileInfo file in filess)
{
var lf = "insert into listfile(filename,lastWriteTime)values(@filename,@lastWriteTime)";
var cmd = new NpgsqlCommand(lf, conn);
DateTime lastWriteTime = file.LastWriteTime;
cmd.Parameters.AddWithValue("filename", Convert.ToString(file));
string filename = cmd.Parameters["@filename"].Value.ToString();
Console.WriteLine("Record inserted successfully. filename = " + file);
cmd.Parameters.AddWithValue("file last write time", Convert.ToDateTime(lastWriteTime));
string lastwritetime = cmd.Parameters["@lastWriteTime"].Value.ToString();
Console.WriteLine("Record inserted successfully. file last write time = " + lastWriteTime);
Console.WriteLine("File list : " + file);
Console.WriteLine("Time last Edit : " + lastWriteTime);
if (file.Exists)
{
var sel = "select * from listfile";
var cmd1 = new NpgsqlCommand(sel, conn);
}
else
{
}
}
I'm stuck at here, help me please
Reply
Answers (
6
)
post image to another profile pic from web cam
Post image using j query