J
Jonas
Hi!
I'm using the Data Access v2 building block from MS for my data access
classes. I have a method which uses SqlHelper.FillDataSet to retrieve a
resultset from a stored procedure. Now I have added three output parameters
to return some extra info, but for some reason the values aren't returned.
If I test the stored procedure in Query Analyzer, I get the values back in
the right fashion, but when run in .NET nothing comes back.
My code looks like this:
Dim sqlParamModifyTime As SqlParameter = New
SqlParameter("@DocumentModifyTime", SqlDbType.DateTime)
Dim sqlParamIsReadLimited As SqlParameter = New
SqlParameter("@IsReadLimited", SqlDbType.Bit)
Dim sqlParamIsUpdateLimited As SqlParameter = New
SqlParameter("@IsUpdateLimited", SqlDbType.Bit)
sqlParamModifyTime.Direction = ParameterDirection.Output
sqlParamIsReadLimited.Direction = ParameterDirection.Output
sqlParamIsUpdateLimited.Direction = ParameterDirection.Output
' Create the sqlParams
Dim sqlParams As SqlParameter() = { _
New SqlParameter("@sessionPK_user",
SqlDbType.UniqueIdentifier), _
New SqlParameter("@FK_Document",
SqlDbType.UniqueIdentifier), _
sqlParamModifyTime, _
sqlParamIsReadLimited, _
sqlParamIsUpdateLimited}
' Set the values
sqlParams(0).Value = New SqlTypes.SqlGuid(SessionPK_user)
sqlParams(1).Value = New SqlTypes.SqlGuid(guidFK_Document)
Try
Dim ds As New DOC_DocumentsBE
ds.EnforceConstraints = False
SqlHelper.FillDataset(cn, "dbo.DOC_PatientsGet", ds, New
String() {"DOC_Patients"}, sqlParams)
' Get value of OUTPUT parameters
dtDocumentModifyTime = sqlParams(2).Value
blnIsReadLimited = sqlParams(3).Value
blnIsUpdateLimited = sqlParams(4).Value
Return (ds)
Finally
Trace.TraceEnd _
("cmcs", strClassName & ".Read",
SessionPK_user.ToString)
End Try
Any tips?
Brgds
Jonas
I'm using the Data Access v2 building block from MS for my data access
classes. I have a method which uses SqlHelper.FillDataSet to retrieve a
resultset from a stored procedure. Now I have added three output parameters
to return some extra info, but for some reason the values aren't returned.
If I test the stored procedure in Query Analyzer, I get the values back in
the right fashion, but when run in .NET nothing comes back.
My code looks like this:
Dim sqlParamModifyTime As SqlParameter = New
SqlParameter("@DocumentModifyTime", SqlDbType.DateTime)
Dim sqlParamIsReadLimited As SqlParameter = New
SqlParameter("@IsReadLimited", SqlDbType.Bit)
Dim sqlParamIsUpdateLimited As SqlParameter = New
SqlParameter("@IsUpdateLimited", SqlDbType.Bit)
sqlParamModifyTime.Direction = ParameterDirection.Output
sqlParamIsReadLimited.Direction = ParameterDirection.Output
sqlParamIsUpdateLimited.Direction = ParameterDirection.Output
' Create the sqlParams
Dim sqlParams As SqlParameter() = { _
New SqlParameter("@sessionPK_user",
SqlDbType.UniqueIdentifier), _
New SqlParameter("@FK_Document",
SqlDbType.UniqueIdentifier), _
sqlParamModifyTime, _
sqlParamIsReadLimited, _
sqlParamIsUpdateLimited}
' Set the values
sqlParams(0).Value = New SqlTypes.SqlGuid(SessionPK_user)
sqlParams(1).Value = New SqlTypes.SqlGuid(guidFK_Document)
Try
Dim ds As New DOC_DocumentsBE
ds.EnforceConstraints = False
SqlHelper.FillDataset(cn, "dbo.DOC_PatientsGet", ds, New
String() {"DOC_Patients"}, sqlParams)
' Get value of OUTPUT parameters
dtDocumentModifyTime = sqlParams(2).Value
blnIsReadLimited = sqlParams(3).Value
blnIsUpdateLimited = sqlParams(4).Value
Return (ds)
Finally
Trace.TraceEnd _
("cmcs", strClassName & ".Read",
SessionPK_user.ToString)
End Try
Any tips?
Brgds
Jonas