File Delete: Path is to long

G

Guest

I keep getting this error and I don't know why:

The path is too long after being fully qualified. Make sure path is less
than 260 characters.

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.IO.PathTooLongException: The path is too long
after being fully qualified. Make sure path is less than 260 characters.

Source Error:


Line 91: {
Line 92: string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead.Close();


Source File: c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs Line: 93

Stack Trace:


[PathTooLongException: The path is too long after being fully qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[] invalidPathChars,
Char[] whitespaceChars, Char directorySeparator, Char altDirectorySeparator,
Char volumeSeparator, Boolean fullCheck, String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.File.Delete(String path) +33
Sonar3.Secured.EVNR.Delete_Click(Object sender, DataGridCommandEventArgs
e) in c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs:93

System.Web.UI.WebControls.DataGrid.OnDeleteCommand(DataGridCommandEventArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)

System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()

the code this is refering to is as follows:

public void Delete_Click(object sender, DataGridCommandEventArgs e)
{
int EditID=(int)clubdg1.DataKeys[(int)e.Item.ItemIndex];

clubconn=new SqlConnection(strClubconnect);
clubconn.Open();
filedeletecmd=new SqlCommand("SELECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead=filedeletecmd.ExecuteReader();
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();

It is refering to the section in particular :
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();

Can someone tell me what is going wrong here?
 
B

Brock Allen

Wow, that stinks. I don't have a good answer, but I wonder if you get the
same behavior if you call:

new FileInfo(fileName).Delete();




I keep getting this error and I don't know why:

The path is too long after being fully qualified. Make sure path is
less than 260 characters.

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.IO.PathTooLongException: The path is too
long after being fully qualified. Make sure path is less than 260
characters.

Source Error:

Line 91: {
Line 92: string UpPath=Server.MapPath("..\\UploadImg" +
"\\").ToString();
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead.Close();
Source File: c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs Line:
93

Stack Trace:

[PathTooLongException: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars,
Char[] whitespaceChars, Char directorySeparator, Char
altDirectorySeparator,
Char volumeSeparator, Boolean fullCheck, String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.File.Delete(String path) +33
Sonar3.Secured.EVNR.Delete_Click(Object sender,
DataGridCommandEventArgs
e) in c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs:93
System.Web.UI.WebControls.DataGrid.OnDeleteCommand(DataGridCommandEven
tArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source,
EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandl
er.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
the code this is refering to is as follows:

public void Delete_Click(object sender, DataGridCommandEventArgs e)
{
int EditID=(int)clubdg1.DataKeys[(int)e.Item.ItemIndex];
clubconn=new SqlConnection(strClubconnect);
clubconn.Open();
filedeletecmd=new SqlCommand("SELECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead=filedeletecmd.ExecuteReader();
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
It is refering to the section in particular :
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
Can someone tell me what is going wrong here?
 
B

Bob Barrows [MVP]

I don't have time to look it up now, but is there a way to convert the path
and file to the "short filename" format?

Brock said:
Wow, that stinks. I don't have a good answer, but I wonder if you get
the same behavior if you call:

new FileInfo(fileName).Delete();




I keep getting this error and I don't know why:

The path is too long after being fully qualified. Make sure path is
less than 260 characters.

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.IO.PathTooLongException: The path is too
long after being fully qualified. Make sure path is less than 260
characters.

Source Error:

Line 91: {
Line 92: string UpPath=Server.MapPath("..\\UploadImg" +
"\\").ToString();
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead.Close();
Source File: c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs Line:
93

Stack Trace:

[PathTooLongException: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars,
Char[] whitespaceChars, Char directorySeparator, Char
altDirectorySeparator,
Char volumeSeparator, Boolean fullCheck, String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.File.Delete(String path) +33
Sonar3.Secured.EVNR.Delete_Click(Object sender,
DataGridCommandEventArgs
e) in c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs:93
System.Web.UI.WebControls.DataGrid.OnDeleteCommand(DataGridCommandEven
tArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source,
EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandl
er.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
the code this is refering to is as follows:

public void Delete_Click(object sender, DataGridCommandEventArgs e)
{
int EditID=(int)clubdg1.DataKeys[(int)e.Item.ItemIndex];
clubconn=new SqlConnection(strClubconnect);
clubconn.Open();
filedeletecmd=new SqlCommand("SELECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead=filedeletecmd.ExecuteReader();
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
It is refering to the section in particular :
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
Can someone tell me what is going wrong here?
 
G

Guest

ha ha Brock "Wow, that stings" isn't the kind of answer I like reading.
Rather discouraging. I looked all over the web for an answer to that and I
pretty well get the same answer. Microsoft put a cap on the character size
of any variable being stuffed into a path. I think I have to find the
directory and tell the application delete xfile from that directory but I
don't know how. Anyhow, I'll try your suggestion. Thank you for responding
so quick.

Sam-

Brock Allen said:
Wow, that stinks. I don't have a good answer, but I wonder if you get the
same behavior if you call:

new FileInfo(fileName).Delete();




I keep getting this error and I don't know why:

The path is too long after being fully qualified. Make sure path is
less than 260 characters.

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.IO.PathTooLongException: The path is too
long after being fully qualified. Make sure path is less than 260
characters.

Source Error:

Line 91: {
Line 92: string UpPath=Server.MapPath("..\\UploadImg" +
"\\").ToString();
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead.Close();
Source File: c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs Line:
93

Stack Trace:

[PathTooLongException: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars,
Char[] whitespaceChars, Char directorySeparator, Char
altDirectorySeparator,
Char volumeSeparator, Boolean fullCheck, String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.File.Delete(String path) +33
Sonar3.Secured.EVNR.Delete_Click(Object sender,
DataGridCommandEventArgs
e) in c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs:93
System.Web.UI.WebControls.DataGrid.OnDeleteCommand(DataGridCommandEven
tArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source,
EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandl
er.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
the code this is refering to is as follows:

public void Delete_Click(object sender, DataGridCommandEventArgs e)
{
int EditID=(int)clubdg1.DataKeys[(int)e.Item.ItemIndex];
clubconn=new SqlConnection(strClubconnect);
clubconn.Open();
filedeletecmd=new SqlCommand("SELECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead=filedeletecmd.ExecuteReader();
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
It is refering to the section in particular :
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
Can someone tell me what is going wrong here?
 
B

Brock Allen

I looked for this but couldn't find a managed API for it. That's why I said
"this stinks". Though, I didn't look very hard.




I don't have time to look it up now, but is there a way to convert the
path and file to the "short filename" format?

Brock said:
Wow, that stinks. I don't have a good answer, but I wonder if you get
the same behavior if you call:

new FileInfo(fileName).Delete();

I keep getting this error and I don't know why:

The path is too long after being fully qualified. Make sure path is
less than 260 characters.

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.IO.PathTooLongException: The path is too
long after being fully qualified. Make sure path is less than 260
characters.

Source Error:

Line 91: {
Line 92: string UpPath=Server.MapPath("..\\UploadImg" +
"\\").ToString();
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead.Close();
Source File: c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs Line:
93
Stack Trace:

[PathTooLongException: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars,
Char[] whitespaceChars, Char directorySeparator, Char
altDirectorySeparator,
Char volumeSeparator, Boolean fullCheck, String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.File.Delete(String path) +33
Sonar3.Secured.EVNR.Delete_Click(Object sender,
DataGridCommandEventArgs
e) in c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs:93
System.Web.UI.WebControls.DataGrid.OnDeleteCommand(DataGridCommandEv
en
tArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source,
EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHan
dl
er.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
the code this is refering to is as follows:
public void Delete_Click(object sender, DataGridCommandEventArgs e)
{
int EditID=(int)clubdg1.DataKeys[(int)e.Item.ItemIndex];
clubconn=new SqlConnection(strClubconnect);
clubconn.Open();
filedeletecmd=new SqlCommand("SELECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead=filedeletecmd.ExecuteReader();
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
It is refering to the section in particular :
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
Can someone tell me what is going wrong here?
 
G

Guest

Thanks for trying anyhow. I'm going to stew on this problem for a bit. I'll
let you know if I figure anything out.

Brock Allen said:
I looked for this but couldn't find a managed API for it. That's why I said
"this stinks". Though, I didn't look very hard.




I don't have time to look it up now, but is there a way to convert the
path and file to the "short filename" format?

Brock said:
Wow, that stinks. I don't have a good answer, but I wonder if you get
the same behavior if you call:

new FileInfo(fileName).Delete();


I keep getting this error and I don't know why:

The path is too long after being fully qualified. Make sure path is
less than 260 characters.

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.IO.PathTooLongException: The path is too
long after being fully qualified. Make sure path is less than 260
characters.

Source Error:

Line 91: {
Line 92: string UpPath=Server.MapPath("..\\UploadImg" +
"\\").ToString();
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead.Close();
Source File: c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs Line:
93
Stack Trace:

[PathTooLongException: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars,
Char[] whitespaceChars, Char directorySeparator, Char
altDirectorySeparator,
Char volumeSeparator, Boolean fullCheck, String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.File.Delete(String path) +33
Sonar3.Secured.EVNR.Delete_Click(Object sender,
DataGridCommandEventArgs
e) in c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs:93
System.Web.UI.WebControls.DataGrid.OnDeleteCommand(DataGridCommandEv
en
tArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source,
EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHan
dl
er.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
the code this is refering to is as follows:
public void Delete_Click(object sender, DataGridCommandEventArgs e)
{
int EditID=(int)clubdg1.DataKeys[(int)e.Item.ItemIndex];
clubconn=new SqlConnection(strClubconnect);
clubconn.Open();
filedeletecmd=new SqlCommand("SELECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead=filedeletecmd.ExecuteReader();
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
It is refering to the section in particular :
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
Can someone tell me what is going wrong here?
 
G

Guest

ha ha I figured out what the damn problem is.
Everytime I load the file path, the file name and the file type, somehow
some way extra white space gets dumped into the database in sqlserver(I have
no idea why). when I set a breakpoint at the beginning of the string I
noticed the whitespace. So I typed trim() at the end of each string and it
worked.

Thank you for Brock and Bob for helping.

Sam-

Brock Allen said:
I looked for this but couldn't find a managed API for it. That's why I said
"this stinks". Though, I didn't look very hard.




I don't have time to look it up now, but is there a way to convert the
path and file to the "short filename" format?

Brock said:
Wow, that stinks. I don't have a good answer, but I wonder if you get
the same behavior if you call:

new FileInfo(fileName).Delete();


I keep getting this error and I don't know why:

The path is too long after being fully qualified. Make sure path is
less than 260 characters.

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.IO.PathTooLongException: The path is too
long after being fully qualified. Make sure path is less than 260
characters.

Source Error:

Line 91: {
Line 92: string UpPath=Server.MapPath("..\\UploadImg" +
"\\").ToString();
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead.Close();
Source File: c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs Line:
93
Stack Trace:

[PathTooLongException: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars,
Char[] whitespaceChars, Char directorySeparator, Char
altDirectorySeparator,
Char volumeSeparator, Boolean fullCheck, String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.File.Delete(String path) +33
Sonar3.Secured.EVNR.Delete_Click(Object sender,
DataGridCommandEventArgs
e) in c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs:93
System.Web.UI.WebControls.DataGrid.OnDeleteCommand(DataGridCommandEv
en
tArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source,
EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHan
dl
er.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
the code this is refering to is as follows:
public void Delete_Click(object sender, DataGridCommandEventArgs e)
{
int EditID=(int)clubdg1.DataKeys[(int)e.Item.ItemIndex];
clubconn=new SqlConnection(strClubconnect);
clubconn.Open();
filedeletecmd=new SqlCommand("SELECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead=filedeletecmd.ExecuteReader();
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
It is refering to the section in particular :
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
Can someone tell me what is going wrong here?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top