Inseting DateTime into MSAccess

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tmarunkumarit@yahoo.com.sg

    Inseting DateTime into MSAccess

    I want to insert datetime values into msaccess using asp.net by vb.. Am getting error that Syntax Error in INSERT INTO statement...

    My query is
    strSQL="insert into group0 (name,addressli ne1,addressline 2,landmark,city ,state,pincode, telephone1,tele phone2,altconta ctno,businessca tegory,product, category,date) values('" & txtname.text & "','" & txtadds1.text & "','" & txtadds2.text & "','" & txtland.text & "', '" & txtcity.text & "', '" & txtstate.text & "' , '" & txtpin.text & "','" & txttel1.text & "','" & txttel2.text & "','" & txtmob.text & "','" & txtbus.text & "','" & txtpro.text & "','" & txtcat.text & "','" & now & "')"

    please help me... send to my email id
  • RobinS

    #2
    Re: Inseting DateTime into MSAccess

    Date/Time fields in MS Access are delimited by the octothorpe (#), not the
    single quote.

    Robin S.
    --------------------------------------
    <tmarunkumarit@ yahoo.com.sgwro te in message
    news:unOoFZ2QHH A.4260@TK2MSFTN GP06.phx.gbl...
    >I want to insert datetime values into msaccess using asp.net by vb.. Am
    >getting error that Syntax Error in INSERT INTO statement...
    >
    My query is
    strSQL="insert into group0
    (name,addressli ne1,addressline 2,landmark,city ,state,pincode, telephone1,tele phone2,altconta ctno,businessca tegory,product, category,date)
    values('" & txtname.text & "','" & txtadds1.text & "','" & txtadds2.text
    & "','" & txtland.text & "', '" & txtcity.text & "', '" & txtstate.text &
    "' , '" & txtpin.text & "','" & txttel1.text & "','" & txttel2.text &
    "','" & txtmob.text & "','" & txtbus.text & "','" & txtpro.text & "','" &
    txtcat.text & "','" & now & "')"
    >
    please help me... send to my email id

    Comment

    • =?Utf-8?B?TWljaGVsIFBvc3NldGggW01DUF0=?=

      #3
      Re: Inseting DateTime into MSAccess

      Well you can actually insert this as a string and as far as i know to every
      database ( inclusive Access ) that acceptst the ISO 8601 standard

      ISO 8601 implements a universal date format ( example : 2004-05-23T14:25:10)

      YYYYMMDD

      INSERT INTO Testtabel
      (Test)
      Values ('2007-01-01')


      however as above wil function without problems on any system ( regrdless of
      the date time settings )
      the recomended way is to use Parameterized query`s in combination with a
      ..Net date type

      HTH

      Michel Posseth


      "RobinS" wrote:
      Date/Time fields in MS Access are delimited by the octothorpe (#), not the
      single quote.
      >
      Robin S.
      --------------------------------------
      <tmarunkumarit@ yahoo.com.sgwro te in message
      news:unOoFZ2QHH A.4260@TK2MSFTN GP06.phx.gbl...
      I want to insert datetime values into msaccess using asp.net by vb.. Am
      getting error that Syntax Error in INSERT INTO statement...

      My query is
      strSQL="insert into group0
      (name,addressli ne1,addressline 2,landmark,city ,state,pincode, telephone1,tele phone2,altconta ctno,businessca tegory,product, category,date)
      values('" & txtname.text & "','" & txtadds1.text & "','" & txtadds2.text
      & "','" & txtland.text & "', '" & txtcity.text & "', '" & txtstate.text &
      "' , '" & txtpin.text & "','" & txttel1.text & "','" & txttel2.text &
      "','" & txtmob.text & "','" & txtbus.text & "','" & txtpro.text & "','" &
      txtcat.text & "','" & now & "')"

      please help me... send to my email id
      >
      >
      >

      Comment

      Working...