Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 15 of 15
  1. #1
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post

    Request.Form and Date issue

    Hello

    I have two small questions.

    I have the following script which gathers variables from an online (Flash) form:

    Dim conn,rs,SQL,myMail,name,email,business,country,message

    name = Request.Form("name")
    email = Request.Form("email")
    business = Request.Form("business")
    country = Request.Form("country")
    message = Request.Form("message")

    'Open MS Access database, store form field values, and close

    The form data seems to take a long time for it to be sent after the 'Submit' button is pressed and I am writing to ask if it has anything to do with the above script.

    Can I not simply write:

    Request.Form("name")?

    The other issue I have is that when the data is stored in my online database, the column for 'Date' is not completed with the date the form was sent. I thought this was done automatically. If not, how can I insert the date, please, preferably in the following format: 7th January 2008.

    This is what I have at the moment:

    SQL="INSERT INTO users (name, email, business, country, message) VALUES ('" & _
    name & "', '" & email & "','" & business & "', '" & country & "', '" & message & "')"

    Many thanks.

    Steve

  • #2
    Regular Coder
    Join Date
    Sep 2007
    Posts
    120
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Hi,

    the reason it's slow is probably because access isn't very good for webapplications.

    You can fill the date column in your table by adding a default value to the column.
    Refer to your access documentation on the exact syntax, I believe it is (Now())

    HTH, Tom

  • #3
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Hello Whatever Jr

    Thank you for your reply.

    Now() returns the date and time and CurrDate = Date() the date only (I don't need the time).

    But how would I code that in my ASP script?

    Many thanks again for any advice.

    Steve

  • #4
    Regular Coder
    Join Date
    Sep 2007
    Posts
    120
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Hi,

    If you want to do it in ASP, then try this:
    Code:
    SQL="INSERT INTO users (name, email, business, country, message, date) VALUES ('" & _
    name & "', '" & email & "','" & business & "', '" & country & "', '" & message & "', #" & Date() & "#)"
    Or add in Access the default value (date()) to the column date'.

    And I'm pretty sure 'date' is a reserved word in Access, so don't use it.

    HTH, Tom

  • #5
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Hello Whatever Jr

    Sorry but I get an error message when I use your statement:

    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

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

    /ASPflash/flashEmailTest.asp, line 29

    Any advise,\please?

    Cheers

    Steve

  • #6
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    Response.write() your generated SQL statement and post it up here.

  • #7
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Hello Spudhead

    Many thanks for taking the time to reply.

    I am not sure how to do that.

    Is it:

    Response.write="INSERT INTO users (name, email, business, country, message, date) VALUES ('" & _
    name & "', '" & email & "','" & business & "', '" & country & "', '" & message & "', #" & Date() & "#)"

    Then show/view the asp file?

    Thanks

    Steve

  • #8
    Regular Coder
    Join Date
    Sep 2007
    Posts
    120
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Try
    Code:
    response.write SQL
    and view the page in your browser.

    HTH, Tom

  • #9
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Hello Whatever Jr

    I am getting this error msg now:

    Microsoft VBScript compilation error '800a0409'

    Unterminated string constant

    /trial/flash.asp, line 88

    "<dt>Message</dt>: <dd>" & MessageTitle & vbcrlf "</dd><br>
    -----------------------------------------------------------^

    I don't seem to be able to view the rsults of the response.writeSQL="INSERT INTO users (name, email, business, country, message) VALUES ('" & _
    name & "', '" & email & "','" & business & "', '" & country & "', '" & message & "')"

    while I have this error.

    Does the error msg indicate the string has not been terminated correctly?

    Cheers again.

    Steve

  • #10
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    I have managed to get this, Whatever Jr, unfortunately:

    Microsoft VBScript runtime error '800a01b6'

    Object doesn't support this property or method: 'Response.writeSQL'

    /ASPflash/flash.asp, line 22

    Sorry to bother you again!

    Steve

  • #11
    Regular Coder
    Join Date
    Sep 2007
    Posts
    120
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Hi,

    There a variable, called SQL, that contains "INSERT INTO bla bla"

    If you want to print that show in your browser, simply type:
    Code:
    response.write SQL
    HTH, Tom

  • #12
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Hello Whatever Jr

    When I type in:

    response.write SQL

    SQL="INSERT INTO users (name, email, business, country, message, date) VALUES ('" & _
    name & "', '" & email & "','" & business & "', '" & country & "', '" & message & "', #" & Date() & "#)"

    This is what I get in the browser:

    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

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

    /trial/flash.asp, line 52

    Do I need to 'dim' the date? I have not done so.

    Also, in my database the sequence of fields is with 'date' at the beginning, not the end. Is that a possible source of problem?

    Steve

  • #13
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    put the line

    response.write SQL

    AFTER the line

    SQL="INSERT INTO users (name, email, business, country, message, date) VALUES ('" & _
    name & "', '" & email & "','" & business & "', '" & country & "', '" & message & "', #" & Date() & "#)"




    in fact... somwehere after this second line, you'll have another bit where you actually execute the SQL statement. It will look something like:

    yourConnection.execute SQL

    comment that out: put an apostrophe at the beginning of that line.
    Last edited by Spudhead; 01-17-2008 at 05:14 PM.

  • #14
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Hello Spudhead

    I have done as you suggest, that is:

    SQL="INSERT INTO users (name, email, business, country, message, date) VALUES ('" & _
    'name & "', '" & email & "','" & business & "', '" & country & "', '" & message & "', #" & Date() & "#)"

    response.write SQL

    'rs.Open SQL, conn

    and I get this:

    http://stevehigham59.7host.com/trial/flash.asp

    Is it looking for a pair of inverted commas?

    Cheers

    Steve

  • #15
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Hello Spudhead

    I have done as you suggest, that is:

    SQL="INSERT INTO users (name, email, business, country, message, date) VALUES ('" & _
    'name & "', '" & email & "','" & business & "', '" & country & "', '" & message & "', #" & Date() & "#)"

    response.write SQL

    'rs.Open SQL, conn

    and I get this:

    http://stevehigham59.7host.com/trial/flash.asp

    Is it looking for a pair of inverted commas?

    Cheers

    Steve


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •