troubleshooting Question

Remove some characters from a String when returned with SqlDataReader GetString.

Avatar of JohnHockett
JohnHockett asked on
ASP.NET
2 Comments1 Solution350 ViewsLast Modified:
Can someone help me with removing the time part from this string "8/15/2005 12:01:00 PM".  I just want to show the date.  The database column is a "char" and I am using the SqlDatareader GetString to return "8/15/2005 12:01:00 PM".

here is part of the code that diaplays the string on the page:

Private Sub AddRecord(ByVal MyDocument As Document, ByVal Data As SqlDataReader)
        'Adds a new MyPage to the MyDocument if needed
        If currentY > bodyBottom Then AddNewPage(MyDocument)

        'Adds alternating background to MyDocument if needed
        If alternateBG Then
            currentPage.Elements.Add(New Rectangle(0, currentY, 504, 18, New WebColor("E0E0FF"), Apply.Fill))
        End If

        'Adds Labels to the MyDocument with data from current record
        '(0)CCID, (1)CCFName, (2)CCLName, (3)CCAddress, (4)CCCity, (5) CCState, (6)CCZip, (7)CCPhone
        '(8)CCEmail, (9)CCName, (10)CCType, (11)CCNumber, (12)CCExpMonth, (13)CCExpYear,(14)CCCVV2,
        '(15)CCAmount, (16)CCPolNumber, (17)CCDateTime, (18)CCProc, (19)CCProcBy, (20)CCProcDate
        '(21)CCDeclined, (22)CCReason
(here is where I would assume the "trimming" would occur, but I cannot find the documentation to help out on this...)
         currentPage.Elements.Add(New Label(Data.GetString(17), 2, currentY + 2, 100, 11, Font.TimesRoman, 11))
       

        'Toggles alternating background
        alternateBG = Not alternateBG
        'Increments the current Y position on the MyPage
        currentY += 18
    End Sub

I can provide more info if needed,

Thanks
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros