将系统时间插入数据库

来源:百度知道 编辑:UC知道 时间:2024/07/01 11:37:15
输入这条语句在asp语言中,为什么会说sql语句有错误
sql="insert into article3 (head,content,author,time) values('"&request.Form("title")&"','"&rcontent&"','"&Session("user")&"','"&now&"')"

sql="insert into article3 (head,content,author,time) values('"&request.Form("title")&"','"&content&"','"&Session("user")&"','"&now()&"')"

因为不知道你sql报什么错 所以也不清楚是什么问题
你的content前面多了个 r 不知道是你发错了还是代码里错了
其他的好象没什么问题
主要是看你插入数据库的内容,如果内容中出现了某些字符会导致出错的
还有最后那个时间 我建议你在数据库里把这字段的默认值改为 =now()
这样是绝对不会出错的

如果我给你的这段代码有错 就把 '"&now()&"' 的 ''去掉试一下

如果还是不行请 联系 我 QQ:369783385

ACCESS数据库
sql="insert into article3 (head,content,author,[time]) values('"&request.Form("title")&"','"&rcontent&"','"&Session("user")&"',Now())"

SQL数据库
sql="insert into article3 (head,content,author,[time]) values('"&request.Form("title")&"','"&rcontent&"','"&Session("user")&&q