Re: File deletion from server folder
- From: James Page <f104@xxxxxxxxxxxxxx>
- Date: Thu, 05 Apr 2007 11:26:52 +0100
Alexey Smirnov wrote:
On Apr 5, 2:38 am, James Page <f...@xxxxxxxxxxxxxx> wrote:Thanks again AlexeyAlexey Smirnov wrote:On Apr 5, 1:02 am, James Page <JamesP...@xxxxxxxxxxxxxxxxxxxxxxxxx>Thanks again Alexey
wrote:
Thanks AlexeyI think it can be similar to the following:
Could you perhaps show me the context of your code say in a buttons click
event?
void DeleteButton_Click(object sender, EventArgs e)
{
//someone deletes their entry on the database
//let us assume that you have a userid UID
//find picture name
string sql1="SELECT picture FROM users WHERE userid=" +
UID.ToString();
....
string filename = ... // result of sql-query
File.Delete(Server.MapPath(filename));
//delete user record
string sql2="DELETE FROM users WHERE userid=" + UID.ToString();
....
}
File is from the System.IO
Do you have a VB.net example?- Hide quoted text -
- Show quoted text -
There is no big difference between C# and VB
Sub DeleteButton_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim filename As String = ...
File.Delete(Server.MapPath(filename))
End Sub
http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx
:-)
If I get into problems I'll re-post
.
- References:
- Re: File deletion from server folder
- From: Alexey Smirnov
- Re: File deletion from server folder
- From: Alexey Smirnov
- Re: File deletion from server folder
- From: James Page
- Re: File deletion from server folder
- From: Alexey Smirnov
- Re: File deletion from server folder
- Prev by Date: Re: Forms Authentication
- Next by Date: Re: Creating variables in a loop!
- Previous by thread: Re: File deletion from server folder
- Next by thread: Using a customvalidator in a Gridview
- Index(es):