Groups | Blog | Home
all groups > dotnet ado.net > april 2008 >

dotnet ado.net : SqlCommandBuilder DeriveParameters Ouput Arg gets wrong direction


JM
4/18/2008 9:17:01 AM
First, I am using the Enterprise Library DatabaseFactory to get a Database
object. I have traced the issue down to the SqlCommandBuilder
DeriveParameters method.

Given a stored procedure args:

CREATE PROCEDURE UpdDept
( @KeyDepartmentIdentifier UNIQUEIDENTIFIER,
@KEYTimestamp BINARY(8),
@NewName NVARCHAR(50),
:
:
@OutTimeStamp BINARY(8)
)

Wheh I call the Database.DiscoverParameters (aka -
SqlCommandBuilder.DeriveParameters) the @OutTimeStamp DbPArameter
(SqlParameter) has its direction set to InputOutput.

SQL procedure parameters are either input or output. InputOut is not
defined (SQL 2005).

Why is the direction set to InputOutput?

This requires that I initialize the output parameter.

JM
JM
4/18/2008 12:22:00 PM
Sorry the parameters should have read:

CREATE PROCEDURE UpdDept
( @KeyDepartmentIdentifier UNIQUEIDENTIFIER,
@KEYTimestamp BINARY(8),
@NewName NVARCHAR(50),
:
:
@OutTimeStamp BINARY(8) OUTOUT
William Vaughn [MVP]
4/18/2008 3:05:38 PM
This is an age-old problem with the interfaces to SQL Server providers. They
cannot discriminate between OUTPUT and Input/output parameters. You'll have
to hard-code these direction properties by hand.

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
[quoted text, click to view]
AddThis Social Bookmark Button