Jon Skeet said:
Could you post a short but complete program which demonstrates the
problem?
See
http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
(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