Compiler catches warning really late

  • Thread starter Thread starter Cirene
  • Start date Start date
C

Cirene

I wrote some code 2 days ago. It consisted of doing a SELECT CASE statement
using a sqldatareader...

Dim dr2 As SqlDataReader = MyCommand2.ExecuteReader
While dr2.Read()
Select Case dr2("AttachmentType")

My code compiles and runs fine for several days. Today I am writing code IN
A DIFFERENT PAGE and when I go to run it, all of a sudden, I get a failed
build. It tells me: "warning BC42036: Operands of type Object used in
expressions for 'Select', 'Case' statements; runtime errors could occur."

2 questions:
1. Why did the compiler wait for so long to tell me? I haven't touched
this code in 2 days!
2. How do you recommend I overcome this issue?

Thanks!
 
You know, I'm going to attribute this to user error (ie ME). Maybe I just
wasn't that observant. Sorry for bothering you all.... :)
 
Back
Top