|
<%
' Declaring variables
Dim name, nric, contact, address, movie, time, date, month, 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
' Receiving values from Form
LastName = ChkString(Request.Form(name))
Nric = ChkString(Request.Form(nric))
Contact = ChkString(Request.Form(contact))
Address = ChkString(Request.Form(address))
Movie = ChkString(Request.Form([movie]))
[Time] = ChkString(Request.Form("time"))
[Date] = ChkString(Request.Form(date))
[Month] = ChkString(Request.Form(month))
data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("form.mdb")
sql_insert = "insert into movie (name, nric, contact, address, time, date, month) values ('" & name & "', '" & nric & "', '" & contact & "', '" & address & "', '" & movie & "', '" & time & "', '" & [date] & "', '" & month & "')"
' Creating Connection Object and opening the database
Set con = Server.CreateObject("ADODB.Connection")
con.Open data_source
con.Execute sql_insert
' Done. Close the connection
con.Close
Set con = Nothing
Response.Write "All records were successfully entered into the database."
%>
it keeps givin me syntax error.
Can anyone help on this?
|
|
|
|
|
|
|
|