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 %>
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.
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
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