Results 1 to 3 of 3

Thread: new in this stuff

  1. #1
    Member
    Join Date
    Oct 99
    Location
    Montreal
    Posts
    59
    Hello i am new in asp but i know VB
    This is my pages
    But i get error her :strSQLQuery = "insert into table1( Name, Date) values('" & UserName & "','" & date & "')"
    and Her :rs.Open strSQLQuery, conn , 3, 3

    <html>
    <%
    Dim UserName
    Dim Conn
    Dim rs
    dim strSQLQuery
    UserName=Request.QueryString("Name")

    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\db1.mdb")

    strSQLQuery = "insert into table1( Name, Date) values('" & UserName & "','" & date & "')"
    response.write strSQLQuery

    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open strSQLQuery, conn , 3, 3

    response.write UserName

    Set rs= Nothing

    %>
    <html>


  2. #2
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 00
    Location
    Gallifrey
    Posts
    602
    What is the error message you are getting? It could be the way you are inserting the date into the recordset. What format is the date you are using in the table? It has to match what's being entered, in the SQL.

    short date : 7/29/00

    medium date : 29-JUL-00

    long date : Saturday, July 29, 2000

    general date : 7/29/00 10:01:23 PM



    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  3. #3
    Guru Clunietp's Avatar
    Join Date
    Oct 99
    Location
    USA
    Posts
    1,844
    DATE is a reserved keyword (probably NAME as well), put brackets around these in your SQL statement:

    strSQLQuery = "insert into table1( Name, Date) values('" & UserName & "','" & date & "')"

    should be

    strSQLQuery = "insert into table1( [Name], [Date]) values('" & UserName & "','" & date & "')"

Posting Permissions

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