Home > front end >  Questions about the use of a custom function efficiency??
Questions about the use of a custom function efficiency??

Time:10-20

For example, I wrote a function getProductINFO (Pro_number, a)
Namely: according to Pro_number, access to field a corresponding value, namely the rs (" a ")

So, if I have 20 fields, this table has 30 line, so, need the number of the circular reference function for:

From line 1 to line 30, 30 times, and that each line to refer to 20 times

Because each row has 20 fields, namely:
GetProductINFO (Pro_number, a), get a field the value of the first
GetProductINFO Pro_number, b), to obtain the value of the field, b
2 times.

This is frequently cited executive function, the efficiency is too low, there are a lot of repeated overhead?
Feeling as well, in the page, one-time read out?
__________________________________________

There's just one problem: I downloaded online source, found that if the function in the asp,
Feeling is that the response. The Write is ASP official syntax, and the author, but wrote an echo and die function, instead, in order to improve coding efficiency, too?
Do any necessary? If it is, in theory, any duplicate code, can be further written function, used to simplify the workload?
Sub echo (Str) 'process: output string [instead of the Response. The Write]
Response. Write (Str)
End Sub

Sub die (Str) 'process: end page and output string
Response. Write (Str)
The response. The End ()
End Sub
_________________________________
One last question, A custom function file, typically by the include references to other pages, assuming A page to reference the include files are 30 k, 30 k, but this is only A function is used, that is A disadvantage for A page? (additional invalid load and resources), is there any better way?


Thank you for your answer! Thank you once again!!!!!





-- -- -- -- -- - with the function I wrote -- -- -- -- -- -- -- --

'Function getProductINFO (Pro_number, a) according to the product ID, query arbitrary field
Set the rsA=server. Createobject (" adodb. You ")
If isnull (Pro_number) Or Pro_number="" Then
GetProductINFO="empty!"
The Else
SqlA="select * from ProductInfo where Pro_number=" & amp; Pro_number
'the Response. The write sqlA
RsA. The open sqlA, conn, 1, 1
If Not rsA. Eof Then
GetProductINFO=rsA (a)
The Else
GetProductINFO="-"
End the if
RsA. Close
The set of rsA=Nothing
End the if
End the Function

CodePudding user response:

Throw throw throw throw
  •  Tags:  
  • ASP
  • Related