Click here to Skip to main content
15,889,216 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Reporting Pin
VenkatFor.NET22-Jan-09 20:25
VenkatFor.NET22-Jan-09 20:25 
GeneralSQL Reporting Services Pin
David Mujica25-Jan-09 2:04
David Mujica25-Jan-09 2:04 
GeneralRe: SQL Reporting Services Pin
Brady Kelly25-Jan-09 2:53
Brady Kelly25-Jan-09 2:53 
Question[newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
jon-8022-Jan-09 4:45
professionaljon-8022-Jan-09 4:45 
AnswerRe: [newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
Ashfield22-Jan-09 4:51
Ashfield22-Jan-09 4:51 
GeneralRe: [newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
jon-8022-Jan-09 4:58
professionaljon-8022-Jan-09 4:58 
AnswerRe: [newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
Colin Angus Mackay22-Jan-09 4:57
Colin Angus Mackay22-Jan-09 4:57 
GeneralRe: [newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
jon-8022-Jan-09 5:11
professionaljon-8022-Jan-09 5:11 
Colin Angus Mackay wrote:
jon_80 wrote:
Although the code passes through here, the value of getTaskRefSQL is null, is this a bug?


Are you sue that getTaskRefSQL is null. Unless you've missed something out of your code in the sample above there is no way getTaskRefSQL can be null at the point in the code you've said it is.


That's what I thought; I checked again and now it has a value, however before it was reading null in the watch window Smile | :)


Colin Angus Mackay wrote:
The result of ExecuteScalar can be one of three things.

1. An object of the type you expect. String in this case
2. a DBNull which means that the value of the column you've selected is null
3. a null which means that the query returned no data. (please check for this rather than use an invalid cast exception)


Explicit conversion was required because implicit conversion is not allowed by the compiler. I think can check for a DBNull using typeof presumably, however, since a value is being returned I'm not sure why the conversion is not working.

Related links:
http://msdn.microsoft.com/en-us/library/58918ffs(VS.71).aspx[^]

Jon

GeneralRe: [newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
Colin Angus Mackay22-Jan-09 5:32
Colin Angus Mackay22-Jan-09 5:32 
GeneralRe: [newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
jon-8022-Jan-09 20:50
professionaljon-8022-Jan-09 20:50 
AnswerRe: [newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
Colin Angus Mackay22-Jan-09 5:08
Colin Angus Mackay22-Jan-09 5:08 
GeneralRe: [newbie] SQLCommand.ExecuteScalar does not convert to (string) Pin
jon-8022-Jan-09 7:12
professionaljon-8022-Jan-09 7:12 
QuestionDelete Value from Cookie Pin
Abdullah S. Abdelhay22-Jan-09 4:43
Abdullah S. Abdelhay22-Jan-09 4:43 
AnswerRe: Delete Value from Cookie Pin
Jon Rista22-Jan-09 6:32
Jon Rista22-Jan-09 6:32 
GeneralRe: Delete Value from Cookie Pin
rama charan22-Jan-09 17:47
rama charan22-Jan-09 17:47 
AnswerRe: Delete Value from Cookie Pin
Rajdev Ramasamy26-Jan-09 22:28
Rajdev Ramasamy26-Jan-09 22:28 
Questionworking with excel files version independantly in asp.net2.0 Pin
Nitin K22-Jan-09 3:47
Nitin K22-Jan-09 3:47 
AnswerRe: working with excel files version independantly in asp.net2.0 Pin
Rutvik Dave22-Jan-09 3:56
professionalRutvik Dave22-Jan-09 3:56 
QuestionASP.NET MVC Pin
Brendan Vogt22-Jan-09 2:31
Brendan Vogt22-Jan-09 2:31 
AnswerRe: ASP.NET MVC Pin
ToddHileHoffer22-Jan-09 2:53
ToddHileHoffer22-Jan-09 2:53 
AnswerRe: ASP.NET MVC Pin
Not Active22-Jan-09 3:24
mentorNot Active22-Jan-09 3:24 
Question[Message Deleted] Pin
jon-8022-Jan-09 2:16
professionaljon-8022-Jan-09 2:16 
AnswerRe: [newbie] Databinding question Pin
Paddy Boyd22-Jan-09 2:21
Paddy Boyd22-Jan-09 2:21 
Questioncomplexity in saving date from different countries Pin
NidhiKanu22-Jan-09 2:08
professionalNidhiKanu22-Jan-09 2:08 
AnswerRe: complexity in saving date from different countries Pin
Ashutosh Phoujdar22-Jan-09 2:35
Ashutosh Phoujdar22-Jan-09 2:35 

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.