|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
System.NullReferenceException: Object reference not set to an instance of an objectcode works perfect locally, but when I tried to publish to an internal server this function generates this error with the following stack trace: [NullReferenceException: Object reference not set to an instance of an object.] SweepstakesIN.Validation.ValidateCode() +327 SweepstakesIN.Validation.Validate() +69 SweepstakesIN.Mailingverification2.Page_Load(Object sender, EventArgs e) +74 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +750 I do not know where the +327 is coming from because there is no line #327 anywhere in the project. The line numbers for the function ValidateCode() are 88 -> 116. sweepCode is a valid field in the database (again this works locally with the same exact source code and data) these two functions are in a vb class called Validation Public Function Validate() As Integer If Len(SweepCode) < 1 Then Return 3 (This is line 69) Select Case CheckDigit() Case 1 Return 1 Case 2 Return 2 End Select Select Case ValidateCode() Case 4 'already verified Return 4 Case True Return 0 Case Else Return 1 End Select End Function Private Function ValidateCode() As Integer Dim MyDSN As String, sql As String Dim con As New ADODB.Connection() Dim rst As New ADODB.Recordset() Dim cmd As New ADODB.Command() MyDSN = "Provider=sqloledb;Data Source=cwcreplicator;Initial Catalog=sweepstakes;User Id=intern;Password=;" sql = "SELECT ID, FirstName, LastName, SweepstakeNumber, Verified " sql = sql & "FROM tblMain WHERE SweepstakeNumber='" & SweepCode & "'" con = CreateObject("ADODB.connection") rst = CreateObject("ADODB.recordset") con.Open(MyDSN) rst.Open(sql, con) If rst.EOF And rst.BOF Then Return False End If If rst("Verified").Value = True Then Return 4 End If FamilyName = rst("FirstName").Value & " " & rst("LastName").Value & " Family" CustomerID = rst("ID").Value Return True End Function All help is welcome. |
|||||||||||||||||||||||