goldfish
05-05-03, 20:04
Kodomeister come help me out.
I get Syntax error in INSERT INTO statement... what might be the problem?
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Server.MapPath("db/gblablablabal.mdb") _
& ";Jet OLEDB:Database Password=im not going to tell you!;"
'Adds new record into database
name = Request.Form("name")
if name = "" then name = "Annon"
sub_date = FormatDateTime(date(),vblongdate)
name = Replace(name, "'", "'")
name = Replace(name, """", """)
tehtitle = Request.Form("title")
post = Request.Form("article")
post = Replace(post, vbCrLf, "<br>")
post = Replace(post, "'", "'")
post = Replace(post, """", """)
post = Replace(post, "", "<a href=")
post = Replace(post, "", "</a>")
post = Replace(post, "", "<a href=mailto:")
post = Replace(post, "", "</a>")
post = Replace(post, "[LT]", ">")
pic_url = Request.Form("pic_url")
If pic_url = "" then
pic_url = "none"
End If
msg = "submitted suscessfully"
strSQL = "INSERT INTO articles(author, sub_date, article, pic_url, title) Values('" & name & "','" & sub_date & "','" & post & "','" & pic_url &"','" & tehtitle & "')"
Conn.Execute(strSQL)
Conn.Close
Set Conn = nothing
And the form it gets it from :
<form action="addnews.asp?add=yes" method=post>
<tr><td>Name : </td><td><input name="name" type=text></td>
<tr><td>Title: </td><td><input name="title" type=text></td>
<tr><td>Pic URL: </td><td><input name="pic_url" type=text></td>
<tr><td colspan=2><textarea name="article" cols=70 rows=20></textarea></td></tr>
<tr><td colspan=2><input type=submit value="Submit Article">
</form></table>
Any ideas?
I get Syntax error in INSERT INTO statement... what might be the problem?
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Server.MapPath("db/gblablablabal.mdb") _
& ";Jet OLEDB:Database Password=im not going to tell you!;"
'Adds new record into database
name = Request.Form("name")
if name = "" then name = "Annon"
sub_date = FormatDateTime(date(),vblongdate)
name = Replace(name, "'", "'")
name = Replace(name, """", """)
tehtitle = Request.Form("title")
post = Request.Form("article")
post = Replace(post, vbCrLf, "<br>")
post = Replace(post, "'", "'")
post = Replace(post, """", """)
post = Replace(post, "", "<a href=")
post = Replace(post, "", "</a>")
post = Replace(post, "", "<a href=mailto:")
post = Replace(post, "", "</a>")
post = Replace(post, "[LT]", ">")
pic_url = Request.Form("pic_url")
If pic_url = "" then
pic_url = "none"
End If
msg = "submitted suscessfully"
strSQL = "INSERT INTO articles(author, sub_date, article, pic_url, title) Values('" & name & "','" & sub_date & "','" & post & "','" & pic_url &"','" & tehtitle & "')"
Conn.Execute(strSQL)
Conn.Close
Set Conn = nothing
And the form it gets it from :
<form action="addnews.asp?add=yes" method=post>
<tr><td>Name : </td><td><input name="name" type=text></td>
<tr><td>Title: </td><td><input name="title" type=text></td>
<tr><td>Pic URL: </td><td><input name="pic_url" type=text></td>
<tr><td colspan=2><textarea name="article" cols=70 rows=20></textarea></td></tr>
<tr><td colspan=2><input type=submit value="Submit Article">
</form></table>
Any ideas?