11月29日 工作总结(ASP.NET代码收藏)

来源:互联网 发布:宁波淘宝客服招聘 编辑:程序博客网 时间:2024/06/05 19:10

1129日工作总结:

1、  修改一个页面后,发现,没必要那么麻烦……有关SQL Server转换为Access,既然Access不支持三个以上的多表查询,可以在列表动态生成的过程中,动态添加数据……

2、  该内存不能为‘Read’的问题:

出现这个现象的原因有两方面:一是硬件,即内存方面有问题,二是软件(涉及到内存分配的问题了)

3、实现连接池的优点:当数据库操作和访问频繁的时候,减少创建连接和打开连接所耗得时间,提升数据库服务器的性能

   实现连接池的缺点:数据库连接池中可能存在着多个已经连接但没有被使用,造成资源浪费。

1130日工作总结:

1、  网站上传后,访问网站,提示错误‘Server Error In’/’Application’,不知是什么原因,看似是网站不稳定,想到会不会是数据库连接的问题,此网站数据库是Access,昨天刚做了一数据库连接池,那是SQL Server的,SQL Server支持连接池,而Access不支持,稍微做了一下改动,声明类对象时,只是简单的组织一下链接语句,在自定义的方法里实现打开、关闭数据库链接,在操作之前判断数据库连接状态,如果是打开状态,先关闭,然后再打开。

2、  申请的虚拟空间,还需要网站备案,索要企业相关信息。

3、  知道有.NET探针这一功能,但还不很了解有关他的理论。

4、  知道有一个选项卡控件-----TabControl控件,有必要可以学习了解一下。

5、  前台绑定,实现时间去秒的功能:

    <%#System.DateTime.Parse(DataBinder.Eval(Container.DataItem,"begtime").ToString()).ToShortDateString()%>

6、 前台绑定,输出数据格式化,“{0F2}”是格式,F2表示小数点后剩两位:

 <%# DataBinder.Eval(Container, "DataItem.PriceMoney","{0:F2}") %>

7、 提取动态网页的内容:

   Uri uri = new Uri("http://www.51aspx.com/");
WebRequest req = WebRequest.Create(uri);
WebResponse resp = req.GetResponse();
Stream str = resp.GetResponseStream();
StreamReader sr = new StreamReader(str,System.Text.Encoding.Default);
string t = sr.ReadToEnd();
this.Response.Write(t.ToString());

8、 打开新的窗口,并显示参数:

    response.write("<script>window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"')</script>")
接收参数:

string a = Request.QueryString("id");
string b = Request.QueryString("id1");

9、点击表格行链接另一页
private void grdCustomer_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
  //点击表格打开
  if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
  
e.Item.Attributes.Add("onclick","window.open('Default.aspx?id=" + e.Item.Cells[0].Text + "');");
}
双击表格连接到另一页

  在itemDataBind事件中
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
  string orderItemID =e.item.cells[1].Text;
  
e.item.Attributes.Add("ondblclick", "location.href='../ShippedGrid.aspx?id=" + orderItemID + "'");
}
双击表格打开新一页

if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
  string orderItemID =e.item.cells[1].Text;
  
e.item.Attributes.Add("ondblclick", "open('../ShippedGrid.aspx?id=" + orderItemID + "')");
}
10
、表格超连接列传递参数

<asp:HyperLinkColumn Target="_blank" headertext="ID
" DataTextField="id" NavigateUrl="aaa.aspx?id='
  <%# DataBinder.Eval(Container.DataItem, "数据字段1")%>' & name='<%# DataBinder.Eval(Container.DataItem, "数据字段
2")%>' />
11
、表格点击改变颜色

if (e.Item.ItemType == ListItemType.Item ||e.Item.ItemType == ListItemType.AlternatingItem)
{
  e.Item.Attributes.Add("onclick","this.style.backgroundColor='#99cc00';
   
this.style.color='buttontext';this.style.cursor='default';");
}
写在DataGrid_ItemDataBound

if (e.Item.ItemType == ListItemType.Item ||e.Item.ItemType == ListItemType.AlternatingItem)
{
e.Item.Attributes.Add("onmouseover","this.style.backgroundColor='#99cc00';
  this.style.color='buttontext';this.style.cursor='default';");
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor='';this.style.color='';");
}
12
、关于日期格式

  日期格式设定
DataFormatString="{0:yyyy-MM-dd}"
  我觉得应该在itembound事件中
e.items.cell["
你的列"].text=DateTime.Parse(e.items.cell["你的列"].text.ToString("yyyy-MM-dd"))
19.
获取错误信息并到指定页面

不要使用Response.Redirect,而应该使用Server.Transfer
  
e.g
// in global.asax
protected void Application_Error(Object sender, EventArgs e) {
if (Server.GetLastError() is HttpUnhandledException)
Server.Transfer("MyErrorPage.aspx");
//
其余的非HttpUnhandledException异常交给ASP.NET自己处理就okay
:)
}
  Redirect会导致postback的产生从而丢失了错误信息,所以页面导向应该直接在服务器端执行,这样就可以在错误处理页面得到出错信息并进行相应的处理

20.
清空Cookie
Cookie.Expires=[DateTime];
Response.Cookies("UserName").Expires = 0
21.
自定义异常处理

//
自定义异常处理类
using System;
using System.Diagnostics;
namespace MyAppException
{
  /// <summary>
  /// 系统异常类ApplicationException继承的应用程序异常处理类。

  /// 自动将异常内容记录到Windows NT/2000的应用程序日志
  /// </summary>
  
public class AppException:System.ApplicationException
  
{
  
public AppException()
  
{
  if (ApplicationConfiguration.EventLogEnabled)LogEvent("出现一个未知错误。
");
  
}
  
public AppException(string message)
  
{
  
LogEvent(message);
  
}
  
public AppException(string message,Exception innerException)
  
{
  
LogEvent(message);
  
if (innerException != null)
  
{
  
LogEvent(innerException.Message);
  
}
  
}
  

  • 11月29日 工作总结(ASP.NET代码收藏)
  • 11月29日 工作总结(ASP.NET代码收藏)
  • 11月29日 工作总结(ASP.NET代码收藏)
  • 11月29日 工作总结(ASP.NET代码收藏)
  • 5月25日-5月29日每周工作总结
  • 这周的工作总结(11月10日 - 11月14日)
  • 2012年12月29日 工作总结
  • 2013年01月29日 工作总结
  • 2015年7月29日工作总结
  • 2015年3月11日工作总结
  • 2017年12月11日工作总结
  • 2006年11月9日 ASP.net教程
  • 2月4日工作总结
  • 12月18日工作总结
  • 12月19日工作总结
  • 3月21日工作总结
  • 【周报】第四周(7月27日~8月2日)工作总结报告
  • 4月15日-5月15日工作总结
  • 11月29日 工作总结(ASP.NET代码收藏)
  • 什么是RIA
  • 瑞星软件已更新,重启电脑后方能正常使用。建议您立即重启电脑 解决办法
  • 井底之蛙
  • Windows CE 5.0 Product Update Rollup, December 31, 2009
  • 11月29日 工作总结(ASP.NET代码收藏)
  • 小波对比
  • 11月29日 工作总结(ASP.NET代码收藏)
  • ABAP OO EMAIL
  • cmd切换路径
  • 拷贝对屏幕图象捕获的文章
  • Visual Studio 2008(C#)XML注释提取成帮助文档的方法
  • ASP.NET MVC框架(第一部分)
  • 免费的C++ IDE: Visual C++ 2005 Express
  • 原创粉丝点击