Erro ao inserir string no banco via formulario (iniciante)
Erro:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in date in query expression 'dte = #27-abril-2007#'.
/add_date.asp, line 23
Conteúdo da linha 23 do referido arquivo:
set rs = my_conn.execute (StrSql)
Veja aqui o codigo completo
<!--#INCLUDE FILE="dbcon.asp" --><%Session.LCID = 1046if Request.Form("pword") <> "agenda" then Response.AddHeader "Não Autorizado ", "401.1" Response.Write "<p><STRONG>Não Autorizado: Login falhou</STRONG></P><P>Por favor verifique a senha utilizada.</p>" Response.Write "<center><a href='diary.asp'>Voltar para agenda</a></center>" Response.End End ifFunction ChkString(string) if string = "" then string = " " ChkString = Replace(string, "'", "''")End Functionset my_conn= Server.CreateObject("ADODB.Connection")my_Conn.Open dsn' Check to see if it's a new record to be added or an old one to updateStrSql= "Select * from diary where dte = #" & Request("view_Date") & "#" set rs = my_conn.execute (StrSql)if rs.BOF or rs.EOF then ' No records found. i.e. New record StrSql ="INSERT INTO diary (dte, text_field) values (#" & request("view_date") & "#, '" & chkString(request("txt")) & "')"else ' Record found. i.e. update record. StrSql = "UPDATE diary SET diary.dte = #" & request("view_date") & "#, text_field = '" & chkString(request("txt")) & "' WHERE id = " & rs("id")End Ifmy_conn.Execute (strSql)my_Conn.Closeset my_conn = nothingResponse.Redirect ("diary.asp?view_date=" & request("view_date"))%>
Obrigado.
Discussão (24)
Carregando comentários...