Welcome to AspAdvice Sign in | Join | Help

Creating SqlParameters Best Practices

*NEW* See the updated post at Sharp Developer: Sql Parameters Best Practices 

This article summarizes some nice ways to create SqlParameter arrays.  When we use SqlHelper, or even without SqlHelper when we use SqlCommands directly, and we want to pass an array of SqlParameters to the function.  The method I will discuss does not require you to hard-code the number of elements, nor does it require you to create a temporary list of some sort, but it requires you to have all the values up front that you want to insert into the list.

 

Published Wednesday, May 16, 2007 5:28 PM by salibhai

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Creating SqlParameters Best Practices

Friday, June 01, 2007 9:33 PM by James
You got the point. That's exactly what we do in our daily coding.

# re: Creating SqlParameters Best Practices

Saturday, June 02, 2007 10:06 AM by DeltaCat
if so, how we control the direction of the parameters

# (摘)SqlParameters最佳实践

Monday, June 04, 2007 7:30 AM by Z.Y.F

# http://cnblogs.com/dflying/archive/2007/06/01/768251.html

Tuesday, June 05, 2007 10:45 AM by TrackBack

# [导入](摘)SqlParameters最佳实践

Monday, September 03, 2007 12:01 AM by 张玉丰

# re: Creating SqlParameters Best Practices

Sunday, September 16, 2007 4:54 PM by 窃听器
Good article, the author thanks!

Leave a Comment

(required) 
required 
(required) 
Enter the code you see below