Object reference not set to an instance of an object

J

Jon Delano

Hello all

This is normally an easy error to fix.
The creation of the object was done correclty.

I have an object that I am using and have been using. Suddenly yesterday I
get this error using it.
I have inregistered the DLL deleted the DLL and copied it from the source
and then re-registered it. Same issue.

I removed the reference from my web app and then added the reference back,
same issue.
Its like the function ParseString has an object in it that isn't being
created properly ... but this worked yesterday just fine.
Until I changed from using an UPDATE query to using a stored procedure
(which should have no berring at all).

I'm stumped. Any ideas at all would be greatly helpful.

Thanks
Jon

Here is the code:

' find the dictations edited in the portal, clean the HTML just
incase it has MS Word stuff in it.
Dim cn As New
SqlConnection(ConfigurationSettings.AppSettings("RepositoryConnectionString"))
Dim cn1 As New
SqlConnection(ConfigurationSettings.AppSettings("RepositoryConnectionString"))
cn.Open()
cn1.Open()

Dim TidyDOC As Tidy.Document (THIS IS THE OBJECT I AM USING)
**************************
Dim eCode As Int16
Dim newTranscript As String

Dim cmdGetDictations As New SqlCommand("select patientdictationid,
isnull(transcript,'') as transcript from tblPatientDictation where
PortalEdit=1", cn)
Dim rdrGetDictations As SqlDataReader =
cmdGetDictations.ExecuteReader

Dim cmdWriteDictation As SqlCommand
Dim intResult As Int16
Dim DictText As String
Dim UpdateCount As Int16

Do While rdrGetDictations.Read

TidyDOC = New Tidy.Document <-------- i do a NEW to create
the object
Try
DictText = rdrGetDictations("transcript")

TidyDOC.SetOptBool(TidyATL.TidyOptionId.TidyWord2000, 1)
TidyDOC.SetOptBool(TidyATL.TidyOptionId.TidyHtmlOut, 1)
eCode = TidyDOC.ParseString(DictText) <----- i
get the obj ref not set here. .. after its been ref twice before this line
...

eCode = TidyDOC.CleanAndRepair

TidyDOC.SetOptBool(TidyATL.TidyOptionId.TidyForceOutput, 1)

newTranscript = TidyDOC.SaveString
newTranscript = newTranscript.Replace("'", "''")
newTranscript = newTranscript.Replace(Chr(34), "''")

cmdWriteDictation = New SqlCommand("spUpdateDictation", cn1)
cmdWriteDictation.CommandType = CommandType.StoredProcedure
cmdWriteDictation.Parameters.Add("@Dictation",
newTranscript)
cmdWriteDictation.Parameters.Add("@DictationID",
rdrGetDictations("patientdictationid"))

intResult = cmdWriteDictation.ExecuteNonQuery
cmdWriteDictation.Dispose()
UpdateCount += 1
Catch ex As Exception
Exit Do
End Try

TidyDOC = Nothing

Loop

cmdGetDictations.Dispose()
cmdGetDictations = Nothing

rdrGetDictations.Close()
rdrGetDictations = Nothing

cmdWriteDictation = Nothing

cn.Close()
cn = Nothing

cn1.Close()
cn1 = Nothing

lblUserMessage.Text = "updated : " & UpdateCount
lblUserMessage.Visible = True
 
R

rsk7

We are experiencing a similar problem with the data reader. We found
this post on the MSDN forums that sounds related.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=137373&SiteID=1&PageID=1

It happens randomly, but once it starts our app quickly falls off a
cliff and we have to reset the servers. We are currently trying turning
off connection pooling which is at best a temp solution. Our
performance requirements won't support this as a long term solution.
Worth a try.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top