473,385 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Compiler catches warning really late

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!

Jun 27 '08 #1
1 1619
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.... :)

"Cirene" <ci****@nowhere.comwrote in message
news:uU**************@TK2MSFTNGP06.phx.gbl...
>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!

Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Hafeez | last post by:
I am having real trouble compiling this code http://www.cs.wisc.edu/~vganti/birchcode/codeHier/AttrProj.tgz The attachment shows errors when compiled using the current version of g++ in a...
43
by: Anitha | last post by:
Hi I observed something while coding the other day: if I declare a character array as char s, and try to use it as any other character array..it works perfectly fine most of the times. It...
8
by: Chul Min Kim | last post by:
Hi, I got a BUS ERROR from one of my company's program. Let me briefly tell our environment. Machine : Sun E3500 (Ultra Sparc II 400Mhz CPU 4EA) OS : Solaris7 Compiler : Sun Workshop...
29
by: junky_fellow | last post by:
Consider the following piece of code: struct junk { int i_val; int i_val1; char c_val; }; int main(void) {
5
by: Robert A Riedel | last post by:
I have a class that is intended to be exported in a DLL that uses another class that is in a static library. All clients that use the DLL will also link with the same static library. In summary,...
5
by: Ondrej Spanel | last post by:
I though that inline functions should be always visible only in the compilation unit where they are defined - meaning if compiler cannot inline them, they should be handled as if declared static....
34
by: Bob | last post by:
Hi, The compiler gives Warning 96 Variable 'cmdSource' is used before it has been assigned a value. A null reference exception could result at runtime. Dim cmdSource as SQlClient.SQLDataReader...
6
by: chrisb | last post by:
Hi, Does anyone know if it's possible to generate a custom compiler warning in vs2005? Something like the //todo: comments (possibly //warning: ), but it would show up in the warnings on every...
4
by: Andrus | last post by:
If ExecuteQuery method sets fields, C# 3.5 compiler issues invalid warning at compile time: Field '... .Contents' is never assigned to To reproduce, create class class Entity<T> { public...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.