ASP.net basic knowledge-common error analysis

Source: Internet
Author: User

1: When the command calls the stored procedure, if the output is dataset, the connection of the selectcommand command object should be pointed out first, otherwise the catch will be empty for a lifetime ..

2: If the varchar field of the stored procedure is in the format of x. x, it is prone to subtle silly errors. Do not miss it [].

3: if the event of the default server control of the ascx file is not overwritten, no automatic return is provided in the control! Remember.

4: Page. RegisterOnSubmitStatement is used in the ascx file...

5: viewstate has soared a lot of useless data in the true state...

6: clearly understand the order of events, such as the difference between onsubmit and onclick...

7: Pay attention to the relationship between page_load and _ dopostback,

8: If you load ascx dynamically on the page, you can clearly identify the operations to be performed by page_init. Do not abuse user controls and custom server controls (Focus)

9: The cs file framework should be clear, and the final integration should be completed.

10. If you use a third-party online editor, you 'd better use the framework. OK ?!

11: do not add a comma to the source after compiling multiple CS files.

12: js loaded in the fifth point can be developed independently. In onsubmit, because the form has only one ascx,

13: system errors are all marked with error codes (which can be written in the help document of the xml document later, and can be shared in multiple languages). This is a good idea.

14: when the control uses loadcontrol, the page attributes are not recognized, and only the inhert of the page is modified.

15: Pay attention to this stored procedure:


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
Whether or not there is a great relationship between () After execute.

16: do not try to modify the global variable in page_load. It does not have that function.

17: the necessity of a program with a tone of uncertainty.

18: the background uses the framework techniques (style, js, and class) to be reasonably arranged. Try to leave the background as independent as possible without relying on some front-end namespaces or classes.

19: using (context = System. Web. HttpContext. Current)

20: Try to make the compiled output file concise and independent. The function is to compile a module into a file, but do not open the module (usercontrol) and common, because UserControl has assembly problems.

21: Reading xml files from a disk is very slow. Do not always read the files. You can put them in the cache.

22: The reader or datareader must be close ();

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.