ASP.net基础知识之常见错误分析

35 篇文章 0 订阅
24 篇文章 0 订阅

border="0" name="I1" align="middle" marginwidth="1" marginheight="1" src="http://www.b199.cn/blog_ads/Google_336_280.htm" frameborder="0" width="336" scrolling="no" height="280">

ASP.net基础知识之常见错误分析
1:command调用存储过程的时候,如果输出是dataset,selectcommand的command对象的connection先要指出,否则catch一辈子也是空的.. 
2:存储过程的varchar字段如果是x.x的这种格式,容易出现细微的傻错误,注意不要漏了[]. 
3:如果ascx文件的默认服务器控件的事件不重写的话在control控件里面没有自动回送!切记. 
4:Page.RegisterOnSubmitStatement在ascx文件中小心使用... 
5:viewstate在true的状态下暴涨了许多没用的数据... 
6:明确掌握事件的前后次序.,诸如onsubmit和onclick的区别没啥说的... 
7:注意page_load和__dopostback的关系, 
8:如果在页面动态加载ascx的话,分清楚page_init的要执行的操作,不要滥用用户控件和自定义服务器控件(重点) 
9:cs文件框架需要明确,最后集成,定版本好. 
10;使用第三方的在线编辑器的话最好使用框架,ok?! 
11:多个CS文件编译的时候后面的源不要加逗号就可以了. 
12:在第五点中加载的js可以单独开发,在onsubmit中,因为form只有一个ascx很多, 
13:系统的错误全部标出错误码(以后可以在xml文档帮助文档中写出,多语言版本可以共用),这想法真好. 
14:控件本身用loadcontrol的时候出现不识别page页面的属性,只有在page页面的inhert修改之. 
15:注意这个存储过程: 

border="0" name="I1" align="middle" marginwidth="1" marginheight="1" src="http://www.b199.cn/blog_ads/Google_468_60.htm" frameborder="0" width="468" scrolling="no" height="60">


CREATE proc spage 
@pagesize int, 
@destpage int 
as 
set nocount on 
declare @id int 
declare @startid intselect @startid = (@destpage - 1)*@pagesizeset rowcount @startid 
select @id = id from [crm_articler]set rowcount @pagesize 
set nocount off 
select * from t_member where id > @id order by id 
GO 
execute后面的()有无有莫大关系. 
16:别在page_load里面试图修改全局变量,没那功能的. 

border="0" name="I1" align="middle" marginwidth="1" marginheight="1" src="http://www.b199.cn/blog_ads/Google_468_60.htm" frameborder="0" width="468" scrolling="no" height="60">

17:带有不确定性口气的程序没看的必要性。 
18:后台使用框架的技巧(style,js,类)布置合理,尽量独立出后台,不依赖前台的部分命名空间或类。 
19:可以这样使用:using (context = System.Web.HttpContext.Current) 
20:尽量把编译的输出文件简洁+独立,功能是一个模块的就编译成一个文件,但不要把module(usercontrol)和普通的放开,因为UserControl有assembly的问题。 
21:磁盘读取xml文件是很慢的,不要老是读取之,可以放入缓存的就放进去。 
22:文件读取reader,或者datareader一定要close();

border="0" name="I1" align="middle" marginwidth="1" marginheight="1" src="http://www.b199.cn/blog_ads/Google_ads_468_15.htm" frameborder="0" width="468" scrolling="no" height="16">

border="0" name="I1" align="middle" marginwidth="1" marginheight="1" src="http://www.b199.cn/blog_ads/Google_syndication_468_60.htm" frameborder="0" width="468" scrolling="no" height="60">

搜索其它相关资源,请用Google搜索:
border="0" name="I1" align="middle" marginwidth="1" marginheight="1" src="http://www.b199.cn/blog_ads/Google_search_40.htm" frameborder="0" width="460" scrolling="no" height="40">

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值