J
John Smith
Hello all,
I don't know c# that well and thus need urget help. I have a page that
displays files from an access database that has a button to be delet file
from database. I need a confirmation box to make sure the user wants to
delet the file. Here is my code:
private string GetFilesFromAccessDb()
{
StringBuilder buffer = new StringBuilder(1024);
buffer.Append("<table align=\"center\" width=\"95%\" border=\"0\"
cellspacing=\"2\" cellpadding=\"2\">");
buffer.Append("<tr><td width=\"40%\"><span
class=\"dimColor\">Name</span></td>");
buffer.Append("<td width=\"20%\" align=\"center\"><span
class=\"dimColor\">Size</span></td>");
buffer.Append("<td width=\"40%\" align=\"center\"><span
class=\"dimColor\">Content Type</span></td></tr>");
using(OleDbConnection con = new OleDbConnection(ConnectionString))
using(OleDbCommand cmd = new OleDbCommand(CmdText, con))
{
con.Open();
OleDbDataReader rd = cmd.ExecuteReader(CommandBehavior.SingleResult |
CommandBehavior.CloseConnection);
while(rd.Read())
{
int fileId;
string fileName;
int fileLength;
string contentType;
fileId = rd.GetInt32(0);
fileName = rd.GetString(1);
fileLength = rd.GetInt32(2);
contentType = rd.GetString(3);
buffer.Append("<tr><td><a href=\"file.aspx?file_id=");
buffer.Append(fileId);
buffer.Append("&mode=view\">");
buffer.Append(fileName);
buffer.Append("</a>");
buffer.Append("</a> [ <a href=\"file.aspx?file_id=");
buffer.Append(fileId);
buffer.Append("&mode=delete\"><font color = red>Del</a></font> ]");
buffer.Append(" [<a href=\"file.aspx?file_id=");
buffer.Append(fileId);
buffer.Append("&mode=download\"><font color = green>Dnld</a></font> ]");
//buffer.Append("<INPUT TYPE = BUTTON NAME = dnldButton VALUE = download
onClick)";
//buffer.Append("<INPUT TYPE = BUTTON NAME = delButton VALUE = Delete>");
buffer.Append("</td><td align=\"center\">");
buffer.Append(fileLength);
buffer.Append("</td><td align=\"center\">");
buffer.Append(contentType);
buffer.Append("</td></tr>");
}
rd.Close();
buffer.Append("</table>");
}
return buffer.ToString();
}
How do i do this?
cheers
I don't know c# that well and thus need urget help. I have a page that
displays files from an access database that has a button to be delet file
from database. I need a confirmation box to make sure the user wants to
delet the file. Here is my code:
private string GetFilesFromAccessDb()
{
StringBuilder buffer = new StringBuilder(1024);
buffer.Append("<table align=\"center\" width=\"95%\" border=\"0\"
cellspacing=\"2\" cellpadding=\"2\">");
buffer.Append("<tr><td width=\"40%\"><span
class=\"dimColor\">Name</span></td>");
buffer.Append("<td width=\"20%\" align=\"center\"><span
class=\"dimColor\">Size</span></td>");
buffer.Append("<td width=\"40%\" align=\"center\"><span
class=\"dimColor\">Content Type</span></td></tr>");
using(OleDbConnection con = new OleDbConnection(ConnectionString))
using(OleDbCommand cmd = new OleDbCommand(CmdText, con))
{
con.Open();
OleDbDataReader rd = cmd.ExecuteReader(CommandBehavior.SingleResult |
CommandBehavior.CloseConnection);
while(rd.Read())
{
int fileId;
string fileName;
int fileLength;
string contentType;
fileId = rd.GetInt32(0);
fileName = rd.GetString(1);
fileLength = rd.GetInt32(2);
contentType = rd.GetString(3);
buffer.Append("<tr><td><a href=\"file.aspx?file_id=");
buffer.Append(fileId);
buffer.Append("&mode=view\">");
buffer.Append(fileName);
buffer.Append("</a>");
buffer.Append("</a> [ <a href=\"file.aspx?file_id=");
buffer.Append(fileId);
buffer.Append("&mode=delete\"><font color = red>Del</a></font> ]");
buffer.Append(" [<a href=\"file.aspx?file_id=");
buffer.Append(fileId);
buffer.Append("&mode=download\"><font color = green>Dnld</a></font> ]");
//buffer.Append("<INPUT TYPE = BUTTON NAME = dnldButton VALUE = download
onClick)";
//buffer.Append("<INPUT TYPE = BUTTON NAME = delButton VALUE = Delete>");
buffer.Append("</td><td align=\"center\">");
buffer.Append(fileLength);
buffer.Append("</td><td align=\"center\">");
buffer.Append(contentType);
buffer.Append("</td></tr>");
}
rd.Close();
buffer.Append("</table>");
}
return buffer.ToString();
}
How do i do this?
cheers