Warning. NET developers often make mistakes

Source: Internet
Author: User

. NET development process is not the program can not run, is the program's efficiency slow with the snail in the crawl; This situation is. NET's new hands are especially common; I don't know why, some introductions. NET development of the book cited in the example code, but also to ignore this problem, especially let me depressed is some of my favorite books also appear the same problem.

This article is not only for. NET Developer's Novice has the help, similarly to which has the experience, also brings some enlightenment and the reference.

What kind of problems will they encounter?

1. Database connection Timeout

2. Create objects to use, regardless of release

3. Debug (Debug) mode is compiled and used in the application environment.

4. Sharing the actual mode of operation

The problem above is like a cancer that accumulates to a certain extent and has far-reaching consequences.

1. Database Connection Timeout article

To know the database connection timeout problem, first look at the following code:

[sample-01]
Public Shared Function GETOEMPN (ByVal pspn As String, ByRef Oempn as String) as Bsresult
Dim Clsresult as new Bsresult
Try
Clsresult.resultid =-1
Dim dtresult As New DataTable
Dim Sql As String = St Ring. Empty
Dim clsoradb As New clsoracliendb
Dim strconn as String = Configurationmanager.connectionstrings ("Connectio Nstring "). ConnectionString
Clsoradb.open (strconn) ' Here is Open, clsoradb.close
SQL = Select Satbmmbrnd is not visible later. OEMPN Fruno from Satbmmbrnd WHERE satbmmbrnd. Matno =: Matno "
Dim params () as Racleparameter = {New OracleParameter (" Matno ", Pspn)}
If clsoradb.filldatatable (Sq L, dtresult, params) = False Then
return clsresult
End If
if dtresult be nothing Then
return Clsresult
End If
If DtResult.Rows.Count > 0 Then
oempn = dtresult.rows (0) ("Fruno"). ToString ()
Else
Oempn = ""
End If
Clsresult.resultid = 1
return Clsresult
Catch ex as EXCEPTION
Clsresult.resultID =-1
return clsresult
End Try
End Function

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.