如何删除文件夹/目录中的图像? [英] how to delete image in folder/directory?
本文介绍了如何删除文件夹/目录中的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是我的代码。
在我的表中我有文件名和id。下面的代码可以删除表中的文件名但是它不能删除保存的图像文件夹..请帮助..
protected void deleteImage_Click( object sender,EventArgs e)
{
string strConnString = ConfigurationManager.ConnectionStrings [ DatabaseConnectionString]。的ConnectionString;
SqlConnection conn = new SqlConnection(strConnString);
conn.Open();
SqlCommand cmd = new SqlCommand( 删除来自ImageTbl其中id =' + txt_delete.Text + ',conn) ;
cmd.ExecuteNonQuery();
conn.Close();
bindgrid();
txt_delete.Text = ;
txt_delete.Focus();
}
解决方案
看看这里:
http://www.c-sharpcorner.com/uploadfile/neelu18924/delete-a-file-in -Asp-Net / [ ^ ]
http://asp-net-example.blogspot.com/2009/01/how-to-delete-file-programmatically-in.html [ ^ ]
below is my code.
in my table i have filename and id.the code below can delete filename in table but it cannot delete the image that saves in folder..Please help..
protected void deleteImage_Click(object sender, EventArgs e)
{
string strConnString = ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(strConnString);
conn.Open();
SqlCommand cmd = new SqlCommand("Delete From ImageTbl Where id= '" + txt_delete.Text + "'", conn);
cmd.ExecuteNonQuery();
conn.Close();
bindgrid();
txt_delete.Text = "";
txt_delete.Focus();
}
解决方案
Have a look here:
http://www.c-sharpcorner.com/uploadfile/neelu18924/delete-a-file-in-Asp-Net/[^]
http://asp-net-example.blogspot.com/2009/01/how-to-delete-file-programmatically-in.html[^]
这篇关于如何删除文件夹/目录中的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文