Click here to Skip to main content
15,893,486 members
Home / Discussions / C#
   

C#

 
GeneralRe: UI, BLL and DAL Pin
PIEBALDconsult9-Aug-11 14:36
mvePIEBALDconsult9-Aug-11 14:36 
AnswerRe: UI, BLL and DAL Pin
Not Active9-Aug-11 5:27
mentorNot Active9-Aug-11 5:27 
QuestionExecuteScalar return value Pin
vanikanc9-Aug-11 3:38
vanikanc9-Aug-11 3:38 
AnswerRe: ExecuteScalar return value Pin
Gareth H9-Aug-11 3:46
Gareth H9-Aug-11 3:46 
AnswerRe: ExecuteScalar return value Pin
Keith Barrow9-Aug-11 3:47
professionalKeith Barrow9-Aug-11 3:47 
AnswerRe: ExecuteScalar return value Pin
Shameel9-Aug-11 4:15
professionalShameel9-Aug-11 4:15 
AnswerRe: ExecuteScalar return value Pin
Matt Meyer9-Aug-11 4:38
Matt Meyer9-Aug-11 4:38 
AnswerRe: ExecuteScalar return value Pin
PIEBALDconsult9-Aug-11 5:14
mvePIEBALDconsult9-Aug-11 5:14 
Those look reasonable, but check for System.DBNull.Value

Here's my current code for ExecuteScalar:

public virtual T
ExecuteScalar<T>
(
    T IfNull
)
{
    lock ( this.command )
    {
        try
        {
            this.OpenCount++ ;

            object result = this.command.ExecuteScalar() ;

            if ( ( result == null ) || ( result == System.DBNull.Value ) )
            {
                result = IfNull ;
            }
            else if ( typeof(T) != result.GetType() )
            {
                result = System.Convert.ChangeType
                (
                    result
                ,
                    typeof(T)
                ) ;
            }
            this.RaiseEvent ( this.OnSuccess , 1 , null ) ;
            return ( (T) result ) ;
        }
        catch ( System.Exception err )
        {
            throw ( this.WrapException
            (
                "ExecuteScalar"
            ,
                this.command
            ,
                err
            ) ) ;
        }
        finally
        {
            this.OpenCount-- ;
        }
    }
}

QuestionSignature of the Program or application Pin
sarang_k9-Aug-11 0:38
sarang_k9-Aug-11 0:38 
AnswerRe: Signature of the Program or application Pin
Pete O'Hanlon9-Aug-11 0:40
mvePete O'Hanlon9-Aug-11 0:40 
GeneralRe: Signature of the Program or application Pin
sarang_k9-Aug-11 0:41
sarang_k9-Aug-11 0:41 
AnswerRe: Signature of the Program or application Pin
Shameel9-Aug-11 0:48
professionalShameel9-Aug-11 0:48 
GeneralRe: Signature of the Program or application Pin
Manfred Rudolf Bihy9-Aug-11 2:50
professionalManfred Rudolf Bihy9-Aug-11 2:50 
GeneralRe: Signature of the Program or application Pin
Shameel9-Aug-11 4:17
professionalShameel9-Aug-11 4:17 
AnswerRe: Signature of the Program or application Pin
Pravin Patil, Mumbai9-Aug-11 1:10
Pravin Patil, Mumbai9-Aug-11 1:10 
QuestionGetting Coordinates of Typed Letters in Textbox Pin
AmbiguousName8-Aug-11 23:28
AmbiguousName8-Aug-11 23:28 
AnswerRe: Getting Coordinates of Typed Letters in Textbox Pin
BobJanova9-Aug-11 0:50
BobJanova9-Aug-11 0:50 
GeneralRe: Getting Coordinates of Typed Letters in Textbox Pin
Pravin Patil, Mumbai9-Aug-11 1:11
Pravin Patil, Mumbai9-Aug-11 1:11 
AnswerRe: Getting Coordinates of Typed Letters in Textbox Pin
BillWoodruff9-Aug-11 9:43
professionalBillWoodruff9-Aug-11 9:43 
Questionembded image im datagridviewimagecolumn problem Pin
md_refay8-Aug-11 22:23
md_refay8-Aug-11 22:23 
QuestionMonitoring Clipboard and copying text from it Pin
Qlex8-Aug-11 21:59
Qlex8-Aug-11 21:59 
AnswerRe: Monitoring Clipboard and copying text from it Pin
BobJanova9-Aug-11 0:40
BobJanova9-Aug-11 0:40 
GeneralRe: Monitoring Clipboard and copying text from it Pin
Qlex9-Aug-11 3:12
Qlex9-Aug-11 3:12 
AnswerRe: Monitoring Clipboard and copying text from it Pin
Shameel9-Aug-11 4:24
professionalShameel9-Aug-11 4:24 
AnswerRe: Monitoring Clipboard and copying text from it Pin
Ravi Bhavnani9-Aug-11 7:50
professionalRavi Bhavnani9-Aug-11 7:50 

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.