Click here to Skip to main content
15,899,679 members
Home / Discussions / C#
   

C#

 
GeneralRe: Garbage collector not freeing memory - honest! Pin
Pete O'Hanlon11-Dec-07 9:49
mvePete O'Hanlon11-Dec-07 9:49 
GeneralRe: Garbage collector not freeing memory - honest! Pin
Luc Pattyn11-Dec-07 9:52
sitebuilderLuc Pattyn11-Dec-07 9:52 
QuestionON_MESSAGE in C# Pin
PKR11-Dec-07 3:57
PKR11-Dec-07 3:57 
GeneralRe: ON_MESSAGE in C# Pin
Anthony Mushrow11-Dec-07 4:08
professionalAnthony Mushrow11-Dec-07 4:08 
GeneralRe: ON_MESSAGE in C# Pin
PKR11-Dec-07 5:08
PKR11-Dec-07 5:08 
GeneralObject cannot be cast from DBNull to other types. Pin
eyeseetee11-Dec-07 3:51
eyeseetee11-Dec-07 3:51 
GeneralRe: Object cannot be cast from DBNull to other types. Pin
Anthony Mushrow11-Dec-07 4:12
professionalAnthony Mushrow11-Dec-07 4:12 
GeneralRe: Object cannot be cast from DBNull to other types. Pin
Pete O'Hanlon11-Dec-07 5:26
mvePete O'Hanlon11-Dec-07 5:26 
If the room code doesn't have anything associated with it, the select max would return null (technically it returns DBNull, but at the database end it's null). What you need to do is save the value to an intermediate variable and then convert it after testing for DBNull.Value.
object value = cmd15.ExecuteScalar();
if (value != DBNull.Value)
{
  max = Convert.ToInt32(value);
}
max++;
This is done off the top of my head so the syntax may be slightly wrong, but you should get the idea from it. More importantly though, don't use direct SQL like this. You leave yourself wide open to a SQL Injection Attack. Consider using parameterized queries instead.


Deja View - the feeling that you've seen this post before.

My blog | My articles



GeneralPassing dynamic 2 dim float array in c# to unmanaged c++ dll Pin
f4hd11-Dec-07 3:14
f4hd11-Dec-07 3:14 
GeneralRe: Passing dynamic 2 dim float array in c# to unmanaged c++ dll Pin
m@u11-Dec-07 3:25
m@u11-Dec-07 3:25 
GeneralRe: Passing dynamic 2 dim float array in c# to unmanaged c++ dll Pin
f4hd11-Dec-07 3:46
f4hd11-Dec-07 3:46 
GeneralRe: Passing dynamic 2 dim float array in c# to unmanaged c++ dll Pin
m@u11-Dec-07 4:15
m@u11-Dec-07 4:15 
GeneralRe: Passing dynamic 2 dim float array in c# to unmanaged c++ dll Pin
f4hd11-Dec-07 8:33
f4hd11-Dec-07 8:33 
GeneralRe: Passing dynamic 2 dim float array in c# to unmanaged c++ dll Pin
m@u11-Dec-07 22:33
m@u11-Dec-07 22:33 
GeneralRe: Passing dynamic 2 dim float array in c# to unmanaged c++ dll Pin
f4hd13-Dec-07 4:23
f4hd13-Dec-07 4:23 
GeneralRe: Passing dynamic 2 dim float array in c# to unmanaged c++ dll Pin
m@u13-Dec-07 5:02
m@u13-Dec-07 5:02 
GeneralRe: Passing dynamic 2 dim float array in c# to unmanaged c++ dll Pin
Skippums11-Dec-07 9:02
Skippums11-Dec-07 9:02 
GeneralRe: Passing dynamic 2 dim float array in c# to unmanaged c++ dll Pin
f4hd11-Dec-07 9:34
f4hd11-Dec-07 9:34 
Questionregarding to dll hell with code Pin
creative2002guy11-Dec-07 2:57
creative2002guy11-Dec-07 2:57 
GeneralRe: regarding to dll hell with code Pin
Pete O'Hanlon11-Dec-07 3:17
mvePete O'Hanlon11-Dec-07 3:17 
GeneralRe: regarding to dll hell with code Pin
Colin Angus Mackay11-Dec-07 3:22
Colin Angus Mackay11-Dec-07 3:22 
JokeRe: regarding to dll hell with code Pin
Luc Pattyn11-Dec-07 4:15
sitebuilderLuc Pattyn11-Dec-07 4:15 
GeneralRe: regarding to dll hell with code Pin
creative2002guy11-Dec-07 7:09
creative2002guy11-Dec-07 7:09 
GeneralEnterprise Library configuration tool Pin
PaulPrice11-Dec-07 2:19
PaulPrice11-Dec-07 2:19 
Generaldatatable column size Pin
arkiboys11-Dec-07 1:55
arkiboys11-Dec-07 1:55 

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.