CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2001
    Posts
    38

    Getting a DateTime field value to a variable

    Hi,

    I am trying to grab a value from a datetime field in SQL, but it doesnt
    return nothing. I have declared:

    Dim strDate as String

    strDate = rsInfo.Fields("UploadDate").Value


    It doesnt return anything. Al my other fields work, except that they are
    of the datatype text.

    How should I declare it??


  2. #2
    Join Date
    Apr 1999
    Location
    VA BEACH
    Posts
    467

    Re: Getting a DateTime field value to a variable



    Dim dtDate as Date
    dtDate = rsInfo.Fields("UploadDate").Value






    look into the Format function to format the date the way you want it to look in the string.



    Jim Hewitt
    Software Developer
    Liberty Tax Service
    www.LibertyTax.com

  3. #3
    Join Date
    Mar 2001
    Posts
    38

    Re: Getting a DateTime field value to a variable

    I have pasted the code into my project...but the variable is now "12:00AM"...how do I fix?


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

Featured