Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

Question on Microsoft Application Blocks

Hi All,

I am trying to learn from the Data Access Application Blocks and am looking through SQLHelper.cs

The routine AissgnParameterValues (starting on line 84) assigns an array of SQLParameter values to a datarow based on the SQLParameter.ParameterName property.

The thing that confuses me is, why do they drop of the first character in ParameterName...

Here's the code
if (dataRow.Table.Columns.IndexOf(commandParameter.ParameterName.Substring(1)) != -1)
                    commandParameter.Value = dataRow[commandParameter.ParameterName.Substring(1)];



Charles Reich
Thursday, April 28, 2005

Misstyped... the routine assigns the dataRow values to the parameters.

Charles Reich
Thursday, April 28, 2005

My assumption is that this is for SQL Sever parameters prefixed with the @ symbol.

BTW, are you using the Enterprise Library?  I couldn't find the SqlHelper.cs file in the Enterprise Library source.  The old DAAB has been deprecated and the Enterprise Library Data Access block has replaced it.

Cowboy coder
Thursday, April 28, 2005


Thanks for the explanation.

I'm only now starting to explore the applicatioin blocks (mostly to learn the recommended patterns & practices).

I found the code I referenced at this URL:

Charles Reich
Thursday, April 28, 2005


Use this link instead.

Charles Reich
Thursday, April 28, 2005

Build your own Data Provider Class

Willie Michael Brown
Wednesday, May 18, 2005

*  Recent Topics

*  Fog Creek Home