本文整理匯總了C#中System.Log.ErrorLog方法的典型用法代碼示例。如果您正苦於以下問題:C# Log.ErrorLog方法的具體用法?C# Log.ErrorLog怎麽用?C# Log.ErrorLog使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Log
的用法示例。
在下文中一共展示了Log.ErrorLog方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: displayTable
public void displayTable()
{
string sBoardName = Request["BoardName"];
string sBoardOrder = Request["OrderBy"];
iPageSectorPosition = Convert.ToInt16(Request["PageSectorPosition"]);
iPageNum = Convert.ToInt16(Request["PageNum"]);
bool bFlag = Convert.ToBoolean(Request["Flag"]);
DBSQL db = new DBSQL();
System.Data.DataTable dt = new System.Data.DataTable();
dt = db.TSelect(sBoardName, sBoardOrder, bFlag);
sBoardOrder = null;
if (bFlag)
bFlag = false;
else
bFlag = true;
HtmlGenericControl tr = new HtmlGenericControl("tr");
thead.Controls.Add(tr);
try
{
foreach (DataColumn col in dt.Columns)
{
HtmlGenericControl th = new HtmlGenericControl("th");
thead.Controls.Add(th);
HtmlGenericControl anchor = new HtmlGenericControl("a");
anchor.Attributes.Add("href", "ViewBoard.aspx?BoardName=" + sBoardName + "&OrderBy=" + col.ColumnName.ToString() + "&Flag=" + bFlag);
anchor.InnerText = col.ColumnName.ToString();
th.Controls.Add(anchor);
}
for(int i=dt.Rows.Count-(iMaxRowLengh*(iPageNum+1));i<dt.Rows.Count-(iMaxRowLengh * iPageNum);i++)
{
if (i < 0)
i = 0;
HtmlGenericControl tr1 = new HtmlGenericControl("tr");
tbody.Controls.Add(tr1);
foreach (DataColumn col in dt.Columns)
{
HtmlGenericControl td = new HtmlGenericControl("td");
td.InnerText = dt.Rows[i][col].ToString();
tr1.Controls.Add(td);
}
}
HtmlGenericControl tr2 = new HtmlGenericControl("tr");
tbody.Controls.Add(tr2);
HtmlGenericControl td1 = new HtmlGenericControl("td");
td1.Attributes.Add("colspan", dt.Columns.Count.ToString());
td1.Attributes.Add("style", "text-align:center");
tr2.Controls.Add(td1);
int iTotalNumberofPage;
if ((dt.Rows.Count % iMaxRowLengh) == 0)
iTotalNumberofPage = dt.Rows.Count / iMaxRowLengh;
else
iTotalNumberofPage = dt.Rows.Count / iMaxRowLengh + 1;
int iStartPage = iPageSectorLengh * iPageSectorPosition;
int iLastPage = iPageSectorLengh * (iPageSectorPosition + 1);
if (iPageSectorPosition > 0)
{
HtmlGenericControl anchorHead = new HtmlGenericControl("a");
anchorHead.Attributes.Add("href", "ViewBoard.aspx?BoardName=" + sBoardName + "&PageNum=" + (iStartPage - iPageSectorLengh) + "&PageSectorPosition=" + (iPageSectorPosition -1));
anchorHead.InnerText = "<< ";
td1.Controls.Add(anchorHead);
}
for (iPageNum = iStartPage; iPageNum < iLastPage; iPageNum++)
{
if ((iTotalNumberofPage - iPageNum) == 0)
break;
HtmlGenericControl anchorBody = new HtmlGenericControl("a");
anchorBody.Attributes.Add("href", "ViewBoard.aspx?BoardName=" + sBoardName + "&PageNum=" + iPageNum + "&PageSectorPosition=" + iPageSectorPosition);
anchorBody.InnerText = (iPageNum + 1) + " ";
td1.Controls.Add(anchorBody);
}
if ((iTotalNumberofPage - iLastPage) > 0)
{
HtmlGenericControl anchorTail = new HtmlGenericControl("a");
anchorTail.Attributes.Add("href", "ViewBoard.aspx?BoardName=" + sBoardName + "&PageNum=" + (iLastPage+1) + "&PageSectorPosition=" + (iPageSectorPosition + 1));
anchorTail.InnerText = ">> ";
td1.Controls.Add(anchorTail);
}
}
catch (Exception ex)
{
Log l = new Log();
l.ErrorLog("Board Error:" + ex);
}
finally
{
//.........這裏部分代碼省略.........