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)];


Thanks,

Charles

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.

http://www.gotdotnet.com/Workspaces/Workspace.aspx?id=295a464a-6072-4e25-94e2-91be63527327

Cowboy coder
Thursday, April 28, 2005

Cowboy,

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:

http://www.microsoft.com/downloads/details.aspx?FamilyId=0325B97A-9534-4349-8038-D56B38EC394C&displaylang=en

Charles Reich
Thursday, April 28, 2005

Sorry...

Use this link instead.

http://www.microsoft.com/downloads/details.aspx?FamilyID=f63d1f0a-9877-4a7b-88ec-0426b48df275&DisplayLang=en

Charles Reich
Thursday, April 28, 2005

Build your own Data Provider Class

Willie Michael Brown
Wednesday, May 18, 2005

*  Recent Topics

*  Fog Creek Home