Results 1 to 5 of 5

Thread: [RESOLVED] C# ParseExact

  1. #1

    Thread Starter
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Resolved [RESOLVED] C# ParseExact

    Can you get the if condition in a single line of code?
    oa is a dataset.
    ACQ_DATE is a column and it could be null.

    Code:
                    if (oa["ACQ_DATE"].ToString() == "")
                    {
                        PurchaseDt = DateTime.Now;
                    }
                    else
                    {
                        PurchaseDt = DateTime.ParseExact(oa["ACQ_DATE"].ToString(),"d",provider);
                    }
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  2. #2
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: C# ParseExact

    purpose? have you considered wrapping into a function?

  3. #3
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: C# ParseExact

    What is your VS version. what is oa ?. Have you considered using Extensions methods ?
    Please mark you thread resolved using the Thread Tools as shown

  4. #4

    Thread Starter
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: C# ParseExact

    Quote Originally Posted by leinad31 View Post
    purpose? have you considered wrapping into a function?
    Wrapping into a function will be my last resort.

    Quote Originally Posted by danasegarane View Post
    What is your VS version. what is oa ?. Have you considered using Extensions methods ?
    VS 2010. OA is an OracleDataReader object. What do you mean by extensions methods?
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  5. #5
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: C# ParseExact

    Refer Extension methods in MSDN
    Please mark you thread resolved using the Thread Tools as shown

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width