Compiler catches warning really late

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!
 
C

Cirene

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.... :)
 

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

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top