I keep trying to insert a row into an Access database and keep getting an error that there is an syntax error in my insert into commmand. I have done this many times and even tried inserting one piece of information instead of the whole line and get the same error can someone please look at this and see if I missed something. I must have because it is still not working.

<%
Set objppDbase=Server.CreateObject("ADODB.Connection")
objppDbase.ConnectionTimeout=60
objppDbase.Open "DSN=Pre-Post"
%>
<%
SQLprepost = "insert into Pre_Post(date,datetime,aname,hoff_received,hoff_received_undoc," & _
"calls_taken,total_calls_taken,num_analyst_shift,rona,tckts_opened,call_tracking," & _
"call_tracking_l1,call_tracking_l2,call_tracking_ref,call_esc,call_esc_pe," & _
"call_esc_crit_disp,call_esc_reef_disp,call_esc_int,call_esc_ops,tckts_closed," & _
"warm_assist,tckts_solutions,tckts_sol_undoc,tckts_owned,tckts_still_open,tckts_passed," & _
"solutions_created,check_email,check_solution,check_summary,check_name)" & _
"values('" & today & "','" & datetime & "','" & name & "','" & hoff & "','" & hoffu & _
"','" & calls & "','" & tcalls & "','" & numba & "','" & rona & "','" & topen & _
"','" & cttopen & "','" & cttopen1 & "','" & cttopen2 & "','" & cttopenr & "','" & _
escalls & "','" & escpe & "','" & esccd & "','" & escrd & "','" & escint & "','" & _
escops & "','" & closed & "','" & wassist & "','" & qtsol & "','" & qtsolu & "','" & _
ownt & "','" & open & "','" & passed & "','" & sol & "','" & c_ema & "','" & c_sol & _
"','" & c_sum & "','" & c_name & "')"

objppDbase.Execute(SQLprepost)
%>

Re: SQL insert into Access database is not working by Bob

Bob
Tue Aug 17 14:58:07 CDT 2004

You cannot debug a syntax error in a sql statement without knowing what the
sql statement is. Use

Response.Write SQLprepost

to see the actual sql statement being sent to the database. Usually seeing
this statement will make it easy to spot what the error is. It helps to use
the Access Query Builder to create a query that does what you want, then
switch to SQL View to see what the sql is supposed to look like.

If you still can't see the problem, post the actual sql statement so we can
check it out.

Most problems like this are caused by concatenation issues caused by
delimiters in your data. These problems can be avoided by eliminating the
use of dynamic sql and using saved parameter queries instead. Google for
posts by me containing those words for details.

Bob Barrows

Kidd wrote:
> I keep trying to insert a row into an Access database and keep
> getting an error that there is an syntax error in my insert into
> commmand. I have done this many times and even tried inserting one
> piece of information instead of the whole line and get the same error
> can someone please look at this and see if I missed something. I
> must have because it is still not working.
>
> <%
> Set objppDbase=Server.CreateObject("ADODB.Connection")
> objppDbase.ConnectionTimeout=60
> objppDbase.Open "DSN=Pre-Post"
> %>
> <%
> SQLprepost = "insert into
>
>
>
>
> Pre_Post(date,datetime,aname,hoff_received,hoff_received_undoc,"
> & _
>
>
>
>
>
>
>
"calls_taken,total_calls_taken,num_analyst_shift,rona,tckts_opened,call_trac
king,"
> & _
>
"call_tracking_l1,call_tracking_l2,call_tracking_ref,call_esc,call_esc_pe,"
> & _
>
"call_esc_crit_disp,call_esc_reef_disp,call_esc_int,call_esc_ops,tckts_close
d,"
> & _
>
"warm_assist,tckts_solutions,tckts_sol_undoc,tckts_owned,tckts_still_open,tc
kts_passed,"
> & _
> "solutions_created,check_email,check_solution,check_summary,check_name)"
> & _ "values('" & today & "','" & datetime & "','" & name & "','" &
> hoff & "','" & hoffu & _ "','" & calls & "','" & tcalls & "','" &
> numba & "','" & rona & "','" & topen & _ "','" & cttopen & "','" &
> cttopen1 & "','" & cttopen2 & "','" & cttopenr & "','" & _ escalls &
> "','" & escpe & "','" & esccd & "','" & escrd & "','" & escint &
> "','" & _ escops & "','" & closed & "','" & wassist & "','" & qtsol &
> "','" & qtsolu & "','" & _ ownt & "','" & open & "','" & passed &
> "','" & sol & "','" & c_ema & "','" & c_sol & _ "','" & c_sum & "','"
> & c_name & "')"
>
> objppDbase.Execute(SQLprepost)
> %>

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



Re: SQL insert into Access database is not working by Viatcheslav

Viatcheslav
Wed Aug 18 08:29:08 CDT 2004

In addition to previous post it seems that you use keywords for column
name - enclose them into brackets:

insert into Pre_Post([date], [datetime] ....)

If possible, use native Jet provider instead of ODBC:

objppDbase.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath(...)

//------------------------------------
Regards,
Vassiliev V. V.
http://www-sharp.com -
Scripting/HTA/.Net Framework IDE

"Kidd" <kidd55555@yahoo.com> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
news:usCzYLJhEHA.3076@tk2msftngp13.phx.gbl...
> I keep trying to insert a row into an Access database and keep getting an
error that there is an syntax error in my insert into commmand. I have done
this many times and even tried inserting one piece of information instead of
the whole line and get the same error can someone please look at this and
see if I missed something. I must have because it is still not working.
>
> <%
> Set objppDbase=Server.CreateObject("ADODB.Connection")
> objppDbase.ConnectionTimeout=60
> objppDbase.Open "DSN=Pre-Post"
> %>
> <%
> SQLprepost = "insert into
Pre_Post(date,datetime,aname,hoff_received,hoff_received_undoc," & _
>
"calls_taken,total_calls_taken,num_analyst_shift,rona,tckts_opened,call_trac
king," & _
>
"call_tracking_l1,call_tracking_l2,call_tracking_ref,call_esc,call_esc_pe,"
& _
>
"call_esc_crit_disp,call_esc_reef_disp,call_esc_int,call_esc_ops,tckts_close
d," & _
>
"warm_assist,tckts_solutions,tckts_sol_undoc,tckts_owned,tckts_still_open,tc
kts_passed," & _
>
"solutions_created,check_email,check_solution,check_summary,check_name)" & _
> "values('" & today & "','" & datetime & "','" & name & "','" & hoff &
"','" & hoffu & _
> "','" & calls & "','" & tcalls & "','" & numba & "','" & rona & "','"
& topen & _
> "','" & cttopen & "','" & cttopen1 & "','" & cttopen2 & "','" &
cttopenr & "','" & _
> escalls & "','" & escpe & "','" & esccd & "','" & escrd & "','" &
escint & "','" & _
> escops & "','" & closed & "','" & wassist & "','" & qtsol & "','" &
qtsolu & "','" & _
> ownt & "','" & open & "','" & passed & "','" & sol & "','" & c_ema &
"','" & c_sol & _
> "','" & c_sum & "','" & c_name & "')"
>
> objppDbase.Execute(SQLprepost)
> %>