Hi there,
I've written a new DAL and BLL, but when I try to create an instance of my class, I get an Object Reference error, is there anything particular I should be looking for? I am fairly new to this concept?
Call is such:
Protected Sub btnSignin_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSignin.Click
Dim l As New Log()
l.Log = "Attempted staff login with username [" & txtUsername.Text & "] and password [" & txtPassword.Text & "]"
l.LogId = 0
l.StaffId = 0
l.LogDate = Date.Now()
l.Insert()
The 'Insert' call which is where I get the reference error, calls these functions in my BLL (BLL/Log.vb);
Imports Microsoft.VisualBasic
Imports System.Collections.Generic
Imports System.Transactions
Imports System.Text
Imports Harmony.Zizz.DAL
Namespace Harmony.Zizz.BLL.Zizz
Public Class Log
Inherits BaseZizz
Protected _logid As Integer = 0
Protected _log As String = ""
Protected _staffid As Integer = 0
Protected _logdate As DateTime = Date.Now
Public Sub New()
End Sub
Public Sub New(ByVal logid As Integer, ByVal log As String, ByVal staffid As Integer, ByVal logdate As DateTime)
End Sub
'////property setup removed for brevity ////
Public Property LogId() As Integer
Public Property Log() As String
Public Property LogDate() As DateTime
Public Function Insert() As Integer
Return Harmony.Zizz.BLL.Zizz.Log.InsertLog(Me.LogId, Me.Log, Me.StaffId, Me.LogDate)
End Function
Public Shared Function InsertLog(ByVal logid As Integer, ByVal log As String, ByVal staffid As Integer, ByVal logdate As DateTime) As Integer
HttpContext.Current.Trace.Write("Fired InsertLog BLL (log.vb) Line 61")
Using scope As New TransactionScope()
HttpContext.Current.Trace.Write("Within InsertLog BLL Transaction Scope (log.vb) Line 63")
Dim record As New LogDetails(logid, log, staffid, logdate)
HttpContext.Current.Trace.Write("Created LogDetails Object InsertLog BLL (log.vb) Line 65")
Dim ret As Boolean = SiteProvider.Zizz.InsertLog(record)
HttpContext.Current.Trace.Write("Inserted LogDetails object into SiteProvider InsertLog BLL (log.vb) Line 61")
scope.Complete()
Return ret
End Using
End Function
End Class
End Namespace
The stack trace gets to the Dim ret As Boolean = SiteProvider
line. The SiteProvider calls contains this code, which is where I think the error originates, but have no idea why - or how to fix --- :
Imports Microsoft.VisualBasic
Namespace Harmony.Zizz.DAL
Public NotInheritable Class SiteProvider
Public Shared ReadOnly Property Zizz() As ZizzProvider
Get
Return ZizzProvider.Instance
End Get
End Property
End Class
End Namespace
Help, if able to be given, would be hugely appreciated. Intellisense highlights no problems and if I Build the web site in VS I get a few warnings about schema information in the web.config (unrelated), otherwise no problem.
Help appreciated.