Hi everyone, I am new to this so I have been trying to convert input from form (string) to different data types but can't get it to work. Keeps telling me there is syntax error or expected ')' no matter what way I write it. Have tried everything I think. Here is my completed code. If anyone can help I would be extremely grateful and thanks in advance.
Code:
<html>
<body>
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.ACE.OLEDB.12.0"
conn.Open "c:/inetpub/wwwroot/Sparqs Database.accdb"
sql="INSERT INTO [Attendance]([S_id],[Institution_n],"
sql=sql & "[Training_level],[Training_type], [Session_date], [Session_time],[F_name], [S_name], [Email], [Student_id], [Course_name], [Opt_in])"
sql=sql & " VALUES "
sql=sql & "('"& CONVERT(Request.Form("S_id" INTEGER) & "',"
sql=sql & "'" & Request.Form("Institution_n") & "',"
sql=sql & "'" & Request.Form("Training_level") & "',"
sql=sql & "'" & Request.Form("Training_type") & "',"
sql=sql & "'" & CONVERT(Request.Form("Session_date" DATE) & "',"
sql=sql & "'" & CONVERT(Request.Form("Session_time" TIME) & "',"
sql=sql & "'" & Request.Form("F_name") & "',"
sql=sql & "'" & Request.Form("S_name") & "',"
sql=sql & "'" & Request.Form("Email") & "',"
sql=sql & "'" & Request.Form("Student_id") & "',"
sql=sql & "'" & Request.Form("Course_name") & "',"
sql=sql & "'" & Request.Form("Opt_in") & "')"
on error resume next
conn.Execute sql,recaffected
if err<>0 then
Response.Write(Err.Description)
else
Response.Write("<h3>" & recaffected & " record added</h3>")
end if
conn.close
%>
</body>
</html>
Comment