Date/Time Data Type


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Date/Time Data Type

Hybrid View

  1. #1
    felix Guest

    Date/Time Data Type


    Hi,
    I'm not sure what I'm doing wrong...I can't get my ASP script to Add/Update
    an Access field described with the Date/Time Data Type. Below is my Code
    and the error message I'm getting...Please Help!!!

    mySQL= "INSERT INTO nreport "
    mySQL= mySQL & "(Directoryno,Dealerno,Directoryname,Dealername,Authorizedby,Address1,Address2,Phoneno,Use remail,Action,Comments,test,Date,Time)
    "
    'mySQL= mySQL & "(Dealerno,Dealername,Authorizedby,Address1,Address2,Phoneno,Useremail,Action,Comments,Dat e,Time)"

    mySQL= mySQL & "VALUES ('" & Request.Form("DIRNUM") & "','"
    mySQL= mySQL & Request.Form("DLRNUM") & "','"
    mySQL= mySQL & Request.Form("DIRNME") & "','"
    mySQL= mySQL & Request.Form("Dealername") & "'"
    mySQL= mySQL & ",'" & Request.Form("Authorizedby") & "'"
    mySQL= mySQL & ",'" & Request.Form("Address1") & "','"
    mySQL= mySQL & Request.Form("Address2") & "','"
    mySQL= mySQL & Request.Form("Phoneno") & "','"
    mySQL= mySQL & Request.Form("Useremail") & "','"
    WhichForm


    Function WhichForm()

    Dim myDateTime
    Dim oldMMDDHRMN, myMMDDHRMN
    Dim myMMDDyy, myMMDD, MyTime, MyHr, MyMn, MySc

    MyTime = Time
    MyHr = Hour(MyTime)
    MyMn = Minute(MyTime)
    MySc = Second(MyTime)
    myMMDD = Month(Now()) & Day(Now())

    myMMDDHRMN = MyHr & MyMn & MySc

    'myMMDDyy = Month(Now()) & "/" & Day(Now()) & "/" & year(Now())
    myMMDDyy = Month(Now()) & Day(Now()) & year(Now())



    if myForm="CHANGE" THEN
    mySelectionTxt = Request.Form("Selection")
    myFormActionTxt = "Action: Change"
    mySQL= mySQL & Request.Form("Change") & "','"
    'mySQL= mySQL & Request.Form("Comments") & "')"
    mySQL= mySQL & Request.Form("Comments") & "','" _ & "Testing" & "'," &
    now & "," & now & ")"

    Response.Write "mySQL: " & mySQL


    END IF

    End Function

    Error Msg:
    mySQL: INSERT INTO nreport (Directoryno,Dealerno,Directoryname,Dealername,Authorizedby,Address1,Address2,Phoneno,
    Useremail,Action,Comments,test,Date,Time) VALUES ('057105','0CJBDA2X','GALION','PREMIER
    ELECTRONICS','Mike W',
    'PREMIER ELECTRONICS','Ste 205','419-462-5275','mikew1285@aol.com','Change','felix...testing','Testing',
    4/3/02 2:00:55 PM,4/3/02 2:00:55 PM)
    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

    [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.







  2. #2
    Douglas J. Steele Guest

    Re: Date/Time Data Type

    Date/Times in Access need to be delimited with # symbols.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele


    "felix" <felix5ac@southerninfoservices.com> wrote in message
    news:3cab3943$1@10.1.10.29...
    >
    > Hi,
    > I'm not sure what I'm doing wrong...I can't get my ASP script to

    Add/Update
    > an Access field described with the Date/Time Data Type. Below is my Code
    > and the error message I'm getting...Please Help!!!
    >
    > mySQL= "INSERT INTO nreport "
    > mySQL= mySQL &

    "(Directoryno,Dealerno,Directoryname,Dealername,Authorizedby,Address1,Addres
    s2,Phoneno,Useremail,Action,Comments,test,Date,Time)
    > "
    > 'mySQL= mySQL &

    "(Dealerno,Dealername,Authorizedby,Address1,Address2,Phoneno,Useremail,Actio
    n,Comments,Date,Time)"
    >
    > mySQL= mySQL & "VALUES ('" & Request.Form("DIRNUM") & "','"
    > mySQL= mySQL & Request.Form("DLRNUM") & "','"
    > mySQL= mySQL & Request.Form("DIRNME") & "','"
    > mySQL= mySQL & Request.Form("Dealername") & "'"
    > mySQL= mySQL & ",'" & Request.Form("Authorizedby") & "'"
    > mySQL= mySQL & ",'" & Request.Form("Address1") & "','"
    > mySQL= mySQL & Request.Form("Address2") & "','"
    > mySQL= mySQL & Request.Form("Phoneno") & "','"
    > mySQL= mySQL & Request.Form("Useremail") & "','"
    > WhichForm
    >
    >
    > Function WhichForm()
    >
    > Dim myDateTime
    > Dim oldMMDDHRMN, myMMDDHRMN
    > Dim myMMDDyy, myMMDD, MyTime, MyHr, MyMn, MySc
    >
    > MyTime = Time
    > MyHr = Hour(MyTime)
    > MyMn = Minute(MyTime)
    > MySc = Second(MyTime)
    > myMMDD = Month(Now()) & Day(Now())
    >
    > myMMDDHRMN = MyHr & MyMn & MySc
    >
    > 'myMMDDyy = Month(Now()) & "/" & Day(Now()) & "/" & year(Now())
    > myMMDDyy = Month(Now()) & Day(Now()) & year(Now())
    >
    >
    >
    > if myForm="CHANGE" THEN
    > mySelectionTxt = Request.Form("Selection")
    > myFormActionTxt = "Action: Change"
    > mySQL= mySQL & Request.Form("Change") & "','"
    > 'mySQL= mySQL & Request.Form("Comments") & "')"
    > mySQL= mySQL & Request.Form("Comments") & "','" _ & "Testing" & "'," &
    > now & "," & now & ")"
    >
    > Response.Write "mySQL: " & mySQL
    >
    >
    > END IF
    >
    > End Function
    >
    > Error Msg:
    > mySQL: INSERT INTO nreport

    (Directoryno,Dealerno,Directoryname,Dealername,Authorizedby,Address1,Address
    2,Phoneno,
    > Useremail,Action,Comments,test,Date,Time) VALUES

    ('057105','0CJBDA2X','GALION','PREMIER
    > ELECTRONICS','Mike W',
    > 'PREMIER ELECTRONICS','Ste

    205','419-462-5275','mikew1285@aol.com','Change','felix...testing','Testing'
    ,
    > 4/3/02 2:00:55 PM,4/3/02 2:00:55 PM)
    > Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
    >
    > [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO

    statement.
    >
    >
    >
    >
    >
    >




  3. #3
    qcrsoft Guest

    Re: Date/Time Data Type


    date format:
    sql server/oracle: '2002-1-7'
    access: #2002-1-7#

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center