Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQLParameter converting to integer
Message
From
24/06/2008 10:56:14
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01326205
Message ID:
01326371
Views:
20
This message has been marked as a message which has helped to the initial question of the thread.
>>>>At least I think I tried it yesterday already.
>>>>>
>>>>>BTW, what about my other question regarding declaration of the array? Does it make sense to put it outside the loop or it doesn't matter?
>>>>>
>>>>>I guess I need to re-read the Array chapter.
>>>>
>>>>What message ?
>>>
>>>The original question in this thread. I asked two questions there.
>>>
>>>I also think I need to add UpdateProgress to my page...
>>
>>Oh, this
>>
>> SqlParameter[] parameters = new SqlParameter[2];
>>  parameters[0] = new SqlParameter("RegistrationID", RegID);
>>  parameters[1] = new SqlParameter("PersonID", 0);
>>
>>
>>The general idea is to create as less objects a possible
>>
>>If this is in a loop (SqlParameter[] parameters = new SqlParameter[2]), say n times, you will create n objects that will have to be collected
>>
>>So I would put
>>
>>SqlParameter[] parameters = new SqlParameter[2];
>>
outside the loop
>>
>>
>>As to, new SqlParameter(), you may try to resuse them, by setting their value - if at all possible
>
>Ok, let me try that. The only problem I already approved all the people, I need to insert more records for my tests :)

You won't see much difference by creating as few objects a possible. It's just to help the garbage collector. The overall performance will be better if it does only have to collect 3 objects, instead of 3 * n
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform