Results 1 to 2 of 2
Thread: inserting/updating database
May 27, 2003, 16:34 #1
- Join Date
- May 2003
- 0 Post(s)
- 0 Thread(s)
I am using ASP with MySQL. This is code for a calendar application that saves info to the database based on date. It is not giving an error when processed. Nothing is being inserted into the database and nothing is being updated either. Can anyone help?
vDate = request("view_date")
' Check to see if it's a new record to be added or an old one to update
StrSql= "Select * from diary where dte = '$vDate'"
set rs = DbConn.Execute (StrSql)
chkTxt = chkString(request("txt"))
if rs.BOF or rs.EOF then ' No records found. i.e. New record
StrSql ="INSERT INTO diary (dte, text_field) values ('" & vDate & "','" & chkTxt & "')"
else ' Record found. i.e. update record.
DiaryID = rs("id")
StrSql = "UPDATE diary SET diary.dte = '$vDate', text_field = '$chkTxt' WHERE id = '$DiaryID'"
Also, I have verified that VDate shows a correct date but it only is entered as 0000-00-00 in the database. Should I use timestamp if time is not necessary?