DataReader HasRows problem with DataAccess application block

R

Rob

Using VB.Net 2003 and ADO.Net 1.1 and the MS DataAccess application
block 2.0: I have a stored procedure that returns back records when I
run it manually for a certain record, but in the program executes, the
DataReader.HasRows = False.

I double checked that I am passing the same values manually as the
program is at execution time. Any ideas where to check next?

Thanx,
Rob


Private Function IsPolicyThere( _
ByVal PolicyNumber As String, _
ByVal PolicyEffectiveDt As Date, _
Optional ByVal PolicyRetroDt As Date = NO_RETRO_DATE) As Boolean

'**********************************************************************
'* Check if this policy is already in coverage
(tblfinCoveragePolicy) *

'**********************************************************************
Const STORED_PROC_NAME As String = "pfinPolicyIsItThere"
Dim blnIsPolicyThere As Boolean
Dim arParms() As SqlClient.SqlParameter = New
SqlClient.SqlParameter(2) {}
Dim drPol As SqlClient.SqlDataReader

Try
arParms(0) = New SqlClient.SqlParameter("@PolicyNumber",
SqlDbType.VarChar, 10)
arParms(0).Value = PolicyNumber
arParms(1) = New SqlClient.SqlParameter("@PolEffDt",
SqlDbType.DateTime)
arParms(1).Value = PolicyEffectiveDt
arParms(2) = New SqlClient.SqlParameter("@PolRetroDt",
SqlDbType.DateTime)
arParms(2).Value = PolicyRetroDt

drPol = SqlHelper.ExecuteReader(mstrConnectionString,
CommandType.StoredProcedure, STORED_PROC_NAME, arParms)
If drPol.HasRows Then
blnIsPolicyThere = True
Else
blnIsPolicyThere = False
End If
Catch ex As Exception
Throw ex
Finally
drPol.Close()
End Try

Return blnIsPolicyThere
End Function
 
R

Rob

I'm sorry for posting this; I figured out the problem. I was looking
at two different development DBs; had I checked my connection string
earlier I would have figured this out. Please disregard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top