Click here to Skip to main content
15,895,557 members
Home / Discussions / C#
   

C#

 
AnswerRe: What component should i use? Pin
Suelinda_W26-Apr-04 6:02
Suelinda_W26-Apr-04 6:02 
GeneralReading all IP add in Local network Pin
sreejith ss nair17-Apr-04 23:15
sreejith ss nair17-Apr-04 23:15 
GeneralRe: Reading all IP add in Local network Pin
leppie18-Apr-04 0:49
leppie18-Apr-04 0:49 
GeneralRe: Reading all IP add in Local network Pin
Anonymous18-Apr-04 3:11
Anonymous18-Apr-04 3:11 
GeneralRe: Reading all IP add in Local network Pin
Dave Kreskowiak18-Apr-04 4:47
mveDave Kreskowiak18-Apr-04 4:47 
Generallocking problem in continous insert Pin
dabuskol17-Apr-04 22:19
dabuskol17-Apr-04 22:19 
GeneralRe: locking problem in continous insert Pin
leppie17-Apr-04 22:59
leppie17-Apr-04 22:59 
GeneralRe: locking problem in continous insert Pin
Heath Stewart19-Apr-04 2:51
protectorHeath Stewart19-Apr-04 2:51 
Don't resort to static methods to solve a problem that's pretty simple as leppie suggests. I mean, it may be a good way to go, but to use it simply to paint-over a small problem isn't a good way to fix anything. That's shoddy programming and will bite you in the ars at some point more than likely.

Instead of using DBConnect.State.ToString for a case-sensitive string comparison (not a good idea), use bitwise operators to determine if the connection is closed, something like this:
if ((DBConnect.State & ConnectionState.Closed) != 0) return;
Several enumeration members can be set at once (this could always be true when an enumeration is attributed with the FlagsAttribute) so you need to mask any values and see if they're set.

For instance, ConnectionState.Closed = 0, and ConnectionState.Broken = 16. These could both be set at the same time.
0  = 00000000
16 = 00010000
If both were set, the State property would be set to 16, or 00010000. If you use a bitwise AND to mask Closed, then it looks like this:
State  = 00010000
Closed = 00000000
&      = 00000000 = 0
Without AND'ing it, the result is 16 which does not equal 0.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: locking problem in continous insert Pin
dabuskol19-Apr-04 18:58
dabuskol19-Apr-04 18:58 
GeneralRe: locking problem in continous insert Pin
Heath Stewart20-Apr-04 3:21
protectorHeath Stewart20-Apr-04 3:21 
Questionhow to convert HANDLE type in C#??? Pin
Paolo Ponzano17-Apr-04 21:04
Paolo Ponzano17-Apr-04 21:04 
AnswerRe: how to convert HANDLE type in C#??? Pin
leppie17-Apr-04 21:09
leppie17-Apr-04 21:09 
GeneralRe: how to convert HANDLE type in C#??? Pin
Paolo Ponzano17-Apr-04 21:27
Paolo Ponzano17-Apr-04 21:27 
GeneralSetup project problem Pin
Small Rat17-Apr-04 9:28
Small Rat17-Apr-04 9:28 
GeneralRe: Setup project problem Pin
Mazdak17-Apr-04 23:08
Mazdak17-Apr-04 23:08 
GeneralRe: Setup project problem Pin
Mazdak17-Apr-04 23:40
Mazdak17-Apr-04 23:40 
GeneralRe: Setup project problem Pin
Small Rat18-Apr-04 17:15
Small Rat18-Apr-04 17:15 
GeneralRe: Setup project problem Pin
Heath Stewart19-Apr-04 2:58
protectorHeath Stewart19-Apr-04 2:58 
GeneralC# Custom control property options Pin
mattd8917-Apr-04 8:00
mattd8917-Apr-04 8:00 
GeneralRe: C# Custom control property options Pin
leppie17-Apr-04 21:13
leppie17-Apr-04 21:13 
GeneralReading the serial number Pin
Amirjalaly17-Apr-04 7:27
Amirjalaly17-Apr-04 7:27 
GeneralRe: Reading the serial number Pin
Mazdak17-Apr-04 8:36
Mazdak17-Apr-04 8:36 
Generalconecting with modem Pin
Amirjalaly17-Apr-04 6:42
Amirjalaly17-Apr-04 6:42 
Generalconnecting with modem Pin
Amirjalaly17-Apr-04 6:36
Amirjalaly17-Apr-04 6:36 
Generaldatagrid question Pin
hfuiew17-Apr-04 5:26
hfuiew17-Apr-04 5:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.