SQL Code, INSERT INTO Error 80040e14 (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


Juxtar -> SQL Code, INSERT INTO Error 80040e14 (10/22/2003 17:07:20)

Hi,

I have a form that should insert a survey response into an access database and send an email. The email works fine, but I can't get the "INSERT INTO" code to work it gives me the following error:

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

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


++++
I'm sure it's simple and just my overlooked eye. But here's the code


Dim myConnString
Dim myConnection
Dim mySQL


myConnString = Application("military_faculty_survey_DB_ConnectionString")
Set myConnection = Server.CreateObject("ADODB.Connection")
myConnection.Open myConnString
//sql3 = "INSERT INTO testing_tbl (test_name, test_animal) VALUES ('dudette', 'cat')"
//sql2 = "INSERT INTO military_faculty_survey_tbl (last_name, first_name, email, home_phone, work_phone, company_name, job_title, branch, rank, locations, status, associations) VALUES ('brady', 'Geoff', 'gpbrady@apollogrp.edu', 'hm phone', 'wk phone', 'comp name', 'job title', 'Navy', 'Captain', 'alaska', 'Active', 'boy scouts'"
mySQL = "INSERT INTO military_faculty_survey_tbl "
mySQL = mySQL & "(last_name, first_name, email, home_phone, work_phone, company_name, job_title, military_service, branch, rank, locations, status, associations) "
mySQL = mySQL & "VALUES ('" & Request.Form("last_name") & "', '"
mySQL = mySQL & Request.Form("first_name") & "', '"
mySQL = mySQL & Request.Form("email") & "', '"
mySQL = mySQL & Request.Form("home_phone") & "', '"
mySQL = mySQL & Request.Form("work_phone") & "', '"
mySQL = mySQL & Request.Form("company_name") & "', '"
mySQL = mySQL & Request.Form("job_title") & "', '"
mySQL = mySQL & Request.Form("military_service") & "', '"
mySQL = mySQL & Request.Form("branch") & "', '"
mySQL = mySQL & Request.Form("rank") & "', '"
mySQL = mySQL & Request.Form("locations") & "', '"
mySQL = mySQL & Request.Form("status") & "', '"
mySQL = mySQL & Request.Form("associations") & "'"

myConnection.Execute mySQL
myConnection.Close
Set myConnection = Nothing



I've tried different things. The other SQL statments (in blue) are tests. The first one (sql3) works so I know my connect string is good.

The other sql2, (basically hard coded mysql) has same issues.

What gives?

Jux




Long Island Lune -> RE: SQL Code, INSERT INTO Error 80040e14 (10/22/2003 18:01:59)

mySQL = "INSERT INTO military_faculty_survey_tbl (last_name, first_name, email, home_phone, work_phone, company_name, job_title, military_service, branch, rank, locations, status, associations) VALUES ('::last_name::', '::first_name::', '::email::', '::home_phone::', '::work_phone::', '::company_name::', '::job_title::', '::military_service::', ':: branch::', '::rank::', '::locations::', '::status::', '::associations::')

Are any of these fields numeric? If so replace that field with ::yourfield:: instead.




Juxtar -> RE: SQL Code, INSERT INTO Error 80040e14 (10/22/2003 18:25:46)

I actually solved it. I was missing a parentases ) at the end. I only found it by taking out each line at a time.

thanks for your help though.




Long Island Lune -> RE: SQL Code, INSERT INTO Error 80040e14 (10/22/2003 21:18:08)

Cheers!!!
Welcome to the forum.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875