
Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
> Could you post a short but complete program which demonstrates the
> problem?
[quoted text clipped - 3 lines]
>
> (And I'm fine with it being a VB.NET example, of course :)
Super! Saves me the time of converting it to C# and hunting down all the
missing ; and wondering why ( ) won't work for holding an indexer's value. :)
Company's internet policy won't allow me access to your site :(
Anyway, abbreviated code-behind for my web form is as follows:
Imports Bcbst.IM.FRO.BusinessObjects
Imports Bcbst.IM.FRO.BusinessObjects.UserControl
Imports Bcbst.IM.Common.DataAccessLayer
Imports Bcbst.IM.FRO.Common
Imports Microsoft.Win32
Imports System.Diagnostics
Imports System.Collections
Imports System.Collections.Generic
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Net
Partial Class CheckVouchers_CheckVoucherApprovals
Inherits System.Web.UI.Page
Private currentUser As BcbstUser = Nothing
Private areaID As Integer = Null.NullInteger
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
' Validate user's permissions
currentUser =
BcbstUser.RetrieveUserByBcbstId(My.User.Name.ToLower.Replace("bcbst\",
String.Empty))
areaID = currentUser.AreaId
Dim keyNames As String() = {"ReceiptId"}
Dim gridSource As List(Of CheckVoucherRequest) = _
CheckVoucherRequest.RetrieveAllInfoForVoucherRequests(areaID)
gridVoucherRequests.DataSource = gridSource
gridVoucherRequests.DataKeyNames = keyNames
gridVoucherRequests.DataBind()
End If
End Sub
End Class
Here's an abbreviated copy of my business object class:
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Collections
Imports System.Collections.Generic
Imports System.Web.UI
Imports Bcbst.IM.Common.DataAccessLayer
Imports Bcbst.IM.FRO.Common
Namespace Bcbst.IM.FRO.BusinessObjects
<Serializable()> _
Public Class CheckVoucherRequest
#Region " Members "
Private _ReceiptID As Integer = -1
Private _EntityPaidID As String = String.Empty
Private _EntityTypeID As Integer = -1
Private _EntityTypeName As String = String.Empty
Private _ClaimNumber As Integer = -1
Private _AmountRequested As Decimal = Null.NullDecimal
Private _VoucherReasonCode As String = String.Empty
Private _VoucherReason As String = String.Empty
Private _EntityType As String = String.Empty
Private _AreaID As Integer = -1
Private _WriteErrors As List(Of CheckVoucherError) = New List(Of
CheckVoucherError)
Private Shared _ConnString As String = _
ConfigurationManager.ConnectionStrings("FROMain").ConnectionString
#End Region
Public Shared Function RetrieveAllInfoForVoucherRequests(ByVal areaID As
Integer) 'As List(Of CheckVoucherRequest)
Dim requestList As New List(Of CheckVoucherRequest)
Dim dr As SqlDataReader = SqlDataAccess.ExecuteReader(_ConnString, _
"CheckVoucher.RetrieveInfoForAllRequests", areaID)
While dr.Read()
Dim info As New CheckVoucherRequest(dr("ReceiptID"), _
dr("EntityTypeID"), dr("EntityID"), _
Null.SetNull(dr("ApprovalUserID"), Null.NullString), _
Null.SetNull(dr("ApprovalDate"), Null.NullDate), _
CheckVoucherReason.RetrieveByCode(dr("CheckVoucherReasonCode"),
areaID).ToString(), _
Null.SetNull(dr("ApprovalDeniedReason"), Null.NullString), _
dr("RequestedAmount"))
requestList.Add(info)
End While
Return requestList
End Function
End Class
Jon Skeet [C# MVP] - 19 Oct 2007 22:37 GMT
> > Could you post a short but complete program which demonstrates the
> > problem?
[quoted text clipped - 3 lines]
> >
> > (And I'm fine with it being a VB.NET example, of course :)
> Super! Saves me the time of converting it to C# and hunting down all the
> missing ; and wondering why ( ) won't work for holding an indexer's value. :)
:)
> Company's internet policy won't allow me access to your site :(
Rats.
What I'd really like to see is a version of the code which we can
compile and run ourselves. In other words, it shouldn't be code behind
for a web project (too much hassle to set up) - a simple console
project is easiest. It also shouldn't need to use any classes beyond
the ones shown in the code - after all, we don't need to *do* anything
with the code.
I'd start off by taking your existing business objects library (I'm
assuming it's in its own assembly?) and trying to call the method in
question from a console app. That should give you some more information
about where the problem lies.
One *possible* cause: I don't suppose you've got a property or other
member of your code-behind called CheckVoucherRequest, have you?

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too