Click here to Skip to main content
15,929,686 members
Home / Discussions / C#
   

C#

 
GeneralFolderBrowserDialog Pin
Guinness4Strength18-Jun-04 6:57
Guinness4Strength18-Jun-04 6:57 
GeneralRe: FolderBrowserDialog Pin
Heath Stewart18-Jun-04 13:58
protectorHeath Stewart18-Jun-04 13:58 
GeneralRe: FolderBrowserDialog Pin
Guinness4Strength19-Jun-04 10:33
Guinness4Strength19-Jun-04 10:33 
GeneralRe: FolderBrowserDialog Pin
Heath Stewart20-Jun-04 9:49
protectorHeath Stewart20-Jun-04 9:49 
GeneralIcons Resources Not Being Saved Pin
Peter Vertes18-Jun-04 5:29
Peter Vertes18-Jun-04 5:29 
GeneralRe: Icons Resources Not Being Saved Pin
Heath Stewart18-Jun-04 13:50
protectorHeath Stewart18-Jun-04 13:50 
GeneralRe: Icons Resources Not Being Saved Pin
Peter Vertes18-Jun-04 16:13
Peter Vertes18-Jun-04 16:13 
GeneralRe: Icons Resources Not Being Saved Pin
Heath Stewart18-Jun-04 18:25
protectorHeath Stewart18-Jun-04 18:25 
General\\computer\shared Pin
lustuyck18-Jun-04 4:18
lustuyck18-Jun-04 4:18 
GeneralRe: \\computer\shared Pin
Heath Stewart18-Jun-04 4:40
protectorHeath Stewart18-Jun-04 4:40 
GeneralRe: \\computer\shared Pin
lustuyck22-Jun-04 2:19
lustuyck22-Jun-04 2:19 
GeneralRe: \\computer\shared Pin
Richard Deeming18-Jun-04 7:24
mveRichard Deeming18-Jun-04 7:24 
GeneralRe: \\computer\shared Pin
lustuyck20-Jun-04 22:05
lustuyck20-Jun-04 22:05 
QuestionHow to brows Datasets on other form in my component that droped on a form. Pin
Member 114126618-Jun-04 4:05
Member 114126618-Jun-04 4:05 
AnswerRe: How to brows Datasets on other form in my component that droped on a form. Pin
Heath Stewart18-Jun-04 4:10
protectorHeath Stewart18-Jun-04 4:10 
GeneralRe: How to brows Datasets on other form in my component that droped on a form. Pin
Member 114126618-Jun-04 4:51
Member 114126618-Jun-04 4:51 
GeneralClosing a OleDbConnection Pin
PaleyX18-Jun-04 3:50
PaleyX18-Jun-04 3:50 
GeneralRe: Closing a OleDbConnection Pin
Dave Kreskowiak18-Jun-04 4:05
mveDave Kreskowiak18-Jun-04 4:05 
GeneralRe: Closing a OleDbConnection Pin
Heath Stewart18-Jun-04 4:06
protectorHeath Stewart18-Jun-04 4:06 
Instead of knocking .NET, you should try reading about it before making snap decisions. For example, setting the variable to null after calling Dispose is entirely unncessary.

Also - being a C++ developer - you should know better than to assume a flagged enumeration may have only one enum value set. Instead of _dbConnection.State == ConnectionState.Open, you should use (_dbConnection.State & ConnectionState.Open) != 0) or something similar.

If you're multi-threading this code, it's possible that a command may be executing using that connection, which other ConnectionState values can tell you.

When you're done, all you need to do is call _dbConnection.Dispose(), which will close the connection and free unmanaged resources. Doing all three of those is unncessary. Why is there a Close in addition to Dispose? Because you may want to re-open the connection later, but if you dispose it, you can't - you'll get an ObjectDisposedException, since it has already been disposed.

If you read and understand the documentation for the .NET Framework, this can be a very good environment, but if you prefer VC++ that's fine, too. Just don't knock something because you did something wrong.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Closing a OleDbConnection Pin
PaleyX19-Jun-04 4:54
PaleyX19-Jun-04 4:54 
GeneralOutlook question... Pin
Tartampion18-Jun-04 3:13
Tartampion18-Jun-04 3:13 
GeneralRe: Outlook question... Pin
Stefan Troschuetz18-Jun-04 3:25
Stefan Troschuetz18-Jun-04 3:25 
GeneralRe: Outlook question... Pin
Dave Kreskowiak18-Jun-04 4:00
mveDave Kreskowiak18-Jun-04 4:00 
GeneralRe: Outlook question... Pin
Tartampion18-Jun-04 4:16
Tartampion18-Jun-04 4:16 
GeneralCan't capture arrow keys Pin
jjansen18-Jun-04 3:01
jjansen18-Jun-04 3:01 

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.