1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

ASP with Access Database "Microsoft JET Database Engine error '80040e14' "

Discussion in 'C#' started by seanbenham, Nov 3, 2007.

  1. #1
    When i submit the form on the html page and point it towards my asp page i got this error:

    Microsoft JET Database Engine error '80040e14'
    Syntax error in INSERT INTO statement.


    I'm thinking maybe permission problems with IIS v6?

    Please Help! =)

    This is my code:

    <%
    Dim strJT, strLocation, strJobT, strDesc, strRequirements, strContact, strContDetails, data_source, con, sql_insert


    ' A Function to check if some field entered by user is empty
    Function ChkString(string)
    If string = "" Then string = " "
    ChkString = Replace(string, "'", "''")
    End Function

    strJT = ChkString(Request.Form("JobTitle"))
    strLocation = ChkString(Request.Form("JobLocation"))
    strJobT = ChkString(Request.Form("JobType"))
    strDesc = ChkString(Request.Form("JobDescription"))
    strRequirements = ChkString(Request.Form("JobRequirements"))
    strContact = ChkString(Request.Form("ContactName"))
    strContDetails = ChkString(Request.Form("ContactDetails"))

    data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
    Server.MapPath("db1.mdb")

    sql_insert = "insert into employmentnotice (JobTitle, JobLocation, JobType, JobDescription, JobRequirements, ContactName, ContactDetails) & _
    values ('" & strJT & "', '" & strLocation & "', '" & strJobT & "', '" & strDesc & "','" & strRequirements & "', '" & strContact & "', '" & strDetails & "')"

    Set con = Server.CreateObject("ADODB.Connection")
    con.Open data_source
    con.Execute sql_insert

    ' Done. Close the connection
    con.Close
    Set con = Nothing
    %>
     
    seanbenham, Nov 3, 2007 IP
  2. DPGBB

    DPGBB Peon

    Messages:
    96
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Must be a syntax error as there doesn't appear to be any reserved words in your SQL.
    Try using 'Response.write sql_insert' to debug your code and look at the SQL statement displayed on your browser to see if it looks right.
     
    DPGBB, Nov 3, 2007 IP
  3. cannyinfotech

    cannyinfotech Guest

    Messages:
    105
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    check with the site codeproject.com you will get a good exmaple
     
    cannyinfotech, Jan 30, 2009 IP
  4. cybangerz

    cybangerz Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    setting user permission in your iis configuration
    or your mdb is read only
     
    cybangerz, Jan 30, 2009 IP
  5. tihomir_wwf

    tihomir_wwf Active Member

    Messages:
    363
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    73
    #5
    it seems like error in sql command string, that's why I use LINQ everytime I could :)
     
    tihomir_wwf, Jan 30, 2009 IP
  6. starangel

    starangel Notable Member

    Messages:
    164
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    208
    #6
    Make sure the permission is correct.
     
    starangel, Feb 5, 2009 IP
  7. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #7
    sql_insert = "insert into employmentnotice (JobTitle, JobLocation, JobType, JobDescription, JobRequirements, ContactName, ContactDetails) & _
    values ('" & strJT & "', '" & strLocation & "', '" & strJobT & "', '" & strDesc & "','" & strRequirements & "', '" & strContact & "', '" & strDetails & "')"

    in the query string you use strDetails, whereas it is declared strContDetails
     
    camjohnson95, Feb 16, 2009 IP
  8. gnp

    gnp Peon

    Messages:
    137
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #8
    print the sql string after you fill it and post it here so we can see what exactly is executed on the server ..

    
    response.write( sql_insert ) 
    
    Code (markup):
    take care
     
    gnp, Feb 16, 2009 IP