|
Hi,
string imgFolder = Server.MapPath("folderPath");<br />
string[] imgList = Directory.GetFiles(imgFolder, "*.jpg");<br />
foreach (string img in imgList)<br />
{<br />
FileInfo imgInfo = new FileInfo(img);<br />
if (imgInfo.LastWriteTime < DateTime.Now.AddMinutes(-3))<br />
{<br />
imgInfo.Delete();<br />
}<br />
}<br />
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
System.IO.FileInfo objFileInfo = new System.IO.FileInfo(Server.MapPath(@"../File/") "FileName");
objFileInfo.Delete();
|
|
|
|
|
I am using ffmpeg.exe in my project to convert the uploaded video files(.wmv,.mov,.avi etc) to flash movies files (.flv). I have used process.start() method to execute the executable. In such a scenario every time a file is uploaded, a new process is created for the ffmpeg.exe which converts the uploaded file. This will increase the load on the server as the number of user increase. How can overcome this problem? Can anyone suggest some way out
|
|
|
|
|
Why are you converting videos in a website at all ?
I'm not sure what you can do. Even if you had ahold of the process, how would you know to end it ? Perhap by the video file being done ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Well thanks again Christian, well you are correct I am ending it after the video file is getting converted and saved. I have a requirement for which i have to convert file in my website. This conversion thing is working fine but Then I thought executing an exe file will increase the load on server. Is there any way to tackle the problem..? Hope I have made my problem clear in last post.
I was wondering instead of a process getting created for each upload can we have many threads for a process....? I am just giving an idea....I don't know if it is possible.
|
|
|
|
|
om pr wrote: Is there any way to tackle the problem..?
You can create a windows service and install it on server. This service should look into the uploaded directory, and do the conversion. Since you are doing this in a service, you will get complete handle to the process.
|
|
|
|
|
Well i had thought about that too but our scope is limited because of some reason. We have to implement it in the business logic of the web application itself. As i had asked in the previous post...will the multithreaded concept help...?
|
|
|
|
|
Hi
I am facing some problem in tree view in asp.net 2.0. I bind the tree view with SQL Server. Now, last level for each Node display “+” sign. I want to remove “+” sign on each last level.
How can I do? .Please suggest me to remove the “+” sign of end level node.
Regard
Rajesh
rajesh
|
|
|
|
|
i have binded the records from the database and its working,
but i have written a query to sum a column and display in different column, so totally 2 tables should be binded,
i have binded using 'foreach'
i don't know how to get the error message
|
|
|
|
|
komalcse wrote: but i have written a query to sum a column and display in different column, so totally 2 tables should be binded,
i have binded using 'foreach'
Bind to what?
Apurva Kaushal
|
|
|
|
|
Hi,
i have 2 tables in my database
ihave used text boxes in My code behind to display it.(asp.net and c# with sql)
i have given sql connection using data adapter and dataset
i can view the datas from the database
my doubt is how can i show the error message if there is no information in the database
|
|
|
|
|
If you are using dataset then you can check the rows.count property. If it is returning 0 then there is no records in the database.
Apurva Kaushal
|
|
|
|
|
yes its works
Thanks a lot
but i have another question
now i have two tables in my database,
am not using the gridview to display the information
am using textbox,
how can i display the error message now
i have used,
DataTable dt = ds.Tables[0];
foreach (DataRow dr in dt.Rows)
and
DataTable dt = ds.Tables[1];
foreach (DataRow dr in dt.Rows)
how to display the message
|
|
|
|
|
Here you have to check the count of records for bot the datatables separately and display the message accordingly.
Apurva Kaushal
|
|
|
|
|
Let me repeat my question:
2 tables from the database should be binded to my textboxes separately
can u explain me wit an example so that i can undersatnd better
plz
thanks,
komal
|
|
|
|
|
I am using Asp.Net and C# with SQL
Am using sqldataadapter and dataset to diaplay the records from the database
but i want to display the error message when there is no records in the database
how to do that
can anyone help plz
komal
|
|
|
|
|
Hi,
rccount = (int)DS.Tables("YourTable").Rows.Count
|
|
|
|
|
i have binded the records from the database and its working,
but i have written a query to sum a column and display in different column, so totally 2 tables should be binded,
i have binded using 'foreach'
i don't know how to get the error message
|
|
|
|
|
i have binded the records from the database and its working,
but i have written a query to sum a column and display in different column, so totally 2 tables should be binded,
i have binded using 'foreach'
i don't know how to get the error message
|
|
|
|
|
Create one label outside grid. And when your foreach loop enda, just check grid.rows.count. If its 0 then directly display 'No records found' msg in the label
Nana
|
|
|
|
|
i have used databind to the grid how can i use this condition
|
|
|
|
|
Afer binding you can still check it.
Nana
|
|
|
|
|
$herin wrote: rccount = (int)DS.Tables("YourTable").Rows.Count
Property Count return an integer value, no need of explicit conversion here.
|
|
|
|
|
|
Hello everyone,
I have a page Main.aspx. When I click on a button, it opens a modal dialog by using javascript:
window.showModalDialog(Modal.aspx,... );
That works well.
Then, on the modal page, Modal.apsx, I have a gridview filled in the code-behind to get data from a database.
That works.
When I close the Modal page, I come back to the Main page, great.
Now is the problem ...
When I re-open the modal dialog, it appears again but doesn't run the code-behind!
Does someone know why?
That's annoying as I cannot get the updated data from the database (updated previously with the modal dialog I first opened).
I hope someone will have the answer to how to correct that ...
Thank you!
|
|
|
|