Reputation:
I am trying to add this SQL to a script that will run when the user presses the like button it is meant to add to the like db table, for testing purposes I am using random numbers, however even after making the SQL very simple it still does not work.
The code where this is implemented in the page is below, it works if I insert into another table such as post.
<%
' make VB declare all variables
option explicit
' variable listing and usage
DIM conx ' connection object to the server
DIM comd ' instance of a command object
DIM sql_comd ' string variable to hold the SQL commands
DIM itemsAdded ' numeric var to hold num records added to table (1 or 0)
DIM dbpath ' path to the database file
DIM pos_TIME
DIM pos_DATE
DIM CurrDate
pos_TIME = TIME
CurrDate = Now()
pos_DATE = DATE()
if NOT ISDate(pos_TIME) Then
pos_TIME = "00:00:00"
end if
**sql_comd="INSERT INTO like (lik_POSTID, lik_COMMENTID, lik_USERID, lik_DATE, lik_TIME) VALUES(40, 40, 40, 12/4/2013, 12/4/2013)"**
Upvotes: 1
Views: 202
Reputation: 184
Put some brakets around the like keyword and add quotes around the date :
sql_comd="INSERT INTO [like] (lik_POSTID, lik_COMMENTID, lik_USERID, lik_DATE, lik_TIME) VALUES(40, 40, 40, '12/4/2013', '12/4/2013')"
Upvotes: 1