Click here to Skip to main content
15,895,084 members
Home / Discussions / C#
   

C#

 
GeneralZip files and send to sever Pin
minniemooo12-Mar-08 23:48
minniemooo12-Mar-08 23:48 
GeneralRe: Zip files and send to sever Pin
Christian Graus12-Mar-08 23:58
protectorChristian Graus12-Mar-08 23:58 
Generalcompare today's date and last created file than if more than 7 days delete it Pin
blue112-Mar-08 23:44
blue112-Mar-08 23:44 
GeneralRe: compare today's date and last created file than if more than 7 days delete it Pin
Christian Graus13-Mar-08 0:00
protectorChristian Graus13-Mar-08 0:00 
GeneralRe: compare today's date and last created file than if more than 7 days delete it Pin
blue113-Mar-08 0:06
blue113-Mar-08 0:06 
GeneralRe: compare today's date and last created file than if more than 7 days delete it Pin
phannon8613-Mar-08 0:26
professionalphannon8613-Mar-08 0:26 
GeneralRe: compare today's date and last created file than if more than 7 days delete it Pin
Christian Graus13-Mar-08 0:28
protectorChristian Graus13-Mar-08 0:28 
Generalcompare today's date and last created file than if more than 7 days delete it Pin
blue112-Mar-08 23:43
blue112-Mar-08 23:43 
hi,
I am doing a program with c# and mysql database.
the task is actually taking 2 dates out from the mysql database and compare the 2 dates. if it is more than x days den the file will be deleted.
the following is the program that i have done but i am stuck at the logic that is compare the 2 days if more than x days delete the file.
after that i'll run in the schedule task so that it will run automatically at certain time.
here is my code.

string ConnectionString = "server=localhost;user id=name;password;persist security info=True;database=name of database;";
using (MySqlConnection conn = new MySqlConnection(ConnectionString))
{
MySqlCommand cmd = new MySqlCommand();
conn.Open();
if (conn.State == ConnectionState.Open)
{


cmd.Connection = conn;
cmd.CommandText = "select history ,lastclrhistorydate from table;";
cmd.CommandType = CommandType.Text;
MySqlDataReader reader;
reader = cmd.ExecuteReader();
if ((reader != null))
{
DataTable dt = new DataTable();
dt.Load(reader);

if (dt.Rows.Count == 1)
{
int history = int.Parse(dt.Columns[0].ToString());

string lastclrhistory =dt.Columns[1].ToString();
DateTime currentdate = DateTime.Now;


if ((currentdate - lastclrhistory) == history)
{
//(File.delete(file)
}
GeneralDebug and Release Mode Pin
half-life12-Mar-08 22:54
half-life12-Mar-08 22:54 
GeneralRe: Debug and Release Mode Pin
Bekjong12-Mar-08 23:36
Bekjong12-Mar-08 23:36 
GeneralRe: Debug and Release Mode Pin
half-life13-Mar-08 6:32
half-life13-Mar-08 6:32 
GeneralRe: Debug and Release Mode Pin
Colin Angus Mackay12-Mar-08 23:37
Colin Angus Mackay12-Mar-08 23:37 
GeneralRe: Debug and Release Mode Pin
half-life13-Mar-08 6:33
half-life13-Mar-08 6:33 
GeneralRe: Debug and Release Mode Pin
DJ van Wyk13-Mar-08 2:36
professionalDJ van Wyk13-Mar-08 2:36 
GeneralSystem.Reflection.MethodInfo [modified] Pin
Waheed Ur Rehman12-Mar-08 21:45
Waheed Ur Rehman12-Mar-08 21:45 
GeneralRe: System.Reflection.MethodInfo Pin
Colin Angus Mackay12-Mar-08 23:35
Colin Angus Mackay12-Mar-08 23:35 
GeneralMode Dialog in Vista Pin
jason_mf12-Mar-08 20:15
jason_mf12-Mar-08 20:15 
GeneralRe: Mode Dialog in Vista Pin
Christian Graus12-Mar-08 20:53
protectorChristian Graus12-Mar-08 20:53 
GeneralRe: Mode Dialog in Vista Pin
Pete O'Hanlon13-Mar-08 23:00
mvePete O'Hanlon13-Mar-08 23:00 
Questionhow to get the control panel programatically? Pin
g_hemanth1712-Mar-08 19:58
g_hemanth1712-Mar-08 19:58 
GeneralRe: how to get the control panel programatically? Pin
Anubhava Dimri12-Mar-08 20:34
Anubhava Dimri12-Mar-08 20:34 
QuestionRe: how to get the control panel programatically? [modified] Pin
g_hemanth1712-Mar-08 20:39
g_hemanth1712-Mar-08 20:39 
GeneralRe: how to get the control panel programatically? Pin
Anubhava Dimri12-Mar-08 21:33
Anubhava Dimri12-Mar-08 21:33 
QuestionRe: how to get the control panel programatically? Pin
g_hemanth1712-Mar-08 23:24
g_hemanth1712-Mar-08 23:24 
GeneralRe: how to get the control panel programatically? Pin
Anubhava Dimri13-Mar-08 2:35
Anubhava Dimri13-Mar-08 2:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.