How to Remove Time part from DateTime Field in MS Access Permenently

Discussion in 'Visual Basic .Net' started by DN Admin, Feb 21, 2012.

  1. DN Admin

    Staff Member

    Country:
    United States
    Joined:
    Aug 7, 2010
    Location:
    Joliet, IL U.S.A.
    I am using VB 2008 & Access Database
    for one of my DateTime field in data table i need to Remove it's Time part permently. I have tried following code but Syntax error received.
    <pre class="prettyprint lang-vb Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim cmdText As String = "UPDATE GOODSRECEIPT SET DATE = CAST(DATE AS DATE)" 'CONVERT(CHAR(10), DATE, 103)"
    Dim cmd As New OleDbCommand(cmdText, cnSANDEEP)

    cnSANDEEP.Open()
    Dim I As Integer = cmd.ExecuteNonQuery
    MsgBox(I.ToString & " : RECORDS AFFECTED")

    cnSANDEEP.Close()
    End Sub</pre>
    SANDEEP<br/>
    <br/>

    View the full article
     
    #1

Share This Page