. 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