PC Review


Reply
Thread Tools Rate Thread

DataReader HasRows problem with DataAccess application block

 
 
Rob
Guest
Posts: n/a
 
      8th Feb 2005
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

 
Reply With Quote
 
 
 
 
Rob
Guest
Posts: n/a
 
      8th Feb 2005
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.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataReader .HasRows but returns 'Invalid attempt to read when no data is present' error Assimalyst Microsoft ADO .NET 3 8th May 2006 02:16 PM
Is there a .Net CF equivalent of the DataReader.HasRows method? =?Utf-8?B?Y2hhcmxpZXdlc3Q=?= Microsoft C# .NET 1 31st May 2005 11:41 AM
Microsoft application block dataaccess guoqi zheng Microsoft Dot NET Framework 1 11th May 2005 08:08 PM
MS-Application Dataaccess block (MSADB)??? grawsha2000@yahoo.com Microsoft VB .NET 6 15th Mar 2005 04:42 PM
DataAccess Application Block =?Utf-8?B?Um9iZXJ0?= Microsoft ADO .NET 5 7th Mar 2005 12:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:51 AM.