Dreamcatchers
Posts: 120
|
Posted: 05/20/2012, 8:23 PM |
|
I am trying to update a record when the user selects the program. Their status gets changed to "Attended" upon program access. I placed custom code for the event Server: On intialize view. I get no erros but the database is not updated. Any suggestions would be appreciated.
Code:
Dim Connection, SQL
Set Connection = New clsDBSmart
Connection.Open
sql="UPDATE roster SET Status =" & "Attended" & "where rosterid=6676" Connection.Execute(SQL)
ErrorMessage = CCProcessError(Connection)
Connection.Close
Set Connection = Nothing
On Error Goto 0
_________________
Training and LMS Developer |
|
|
TheunisP
Posts: 342
|
Posted: 05/20/2012, 8:51 PM |
|
perhaps this:
sql="UPDATE roster SET Status ='Attended' WHERE rosterid=6676"
|
|
|
Dreamcatchers
Posts: 120
|
Posted: 05/21/2012, 8:55 AM |
|
That did make a change. The database was updated but now the field is blank. I Don't understand how this couold be since I am updating a text string.
_________________
Training and LMS Developer |
|
|
Dreamcatchers
Posts: 120
|
Posted: 05/21/2012, 8:55 AM |
|
That did make a change. The database was updated but now the field is blank. I Don't understand how this couold be since I am updating a text string.
_________________
Training and LMS Developer |
|
|
TheunisP
Posts: 342
|
Posted: 05/21/2012, 10:19 AM |
|
copy & paste the updated section of code again please
|
|
|
Dreamcatchers
Posts: 120
|
Posted: 05/21/2012, 10:30 AM |
|
Here is the current code:
Dim rosterid, link_course, SQL, Connection, errormessage
rosterid=Request.QueryString("rosterid")
Set Connection = New clsDBSmart
Connection.Open
sql="UPDATE roster SET Status = 'Attended' where rosterid=6676"
Connection.Execute(SQL)
ErrorMessage = CCProcessError(Connection)
Connection.Close
Set Connection = Nothing
On Error Goto 0
_________________
Training and LMS Developer |
|
|
TheunisP
Posts: 342
|
Posted: 05/21/2012, 10:40 AM |
|
do you have a On Error resume next statement in this function before you do the update?
|
|
|
TheunisP
Posts: 342
|
Posted: 05/21/2012, 10:43 AM |
|
just mentioning:
rosterid=CCGetParam("rosterid",0)
sql="UPDATE roster SET Status = 'Attended' where rosterid="&rosterid
|
|
|
Dreamcatchers
Posts: 120
|
Posted: 05/21/2012, 10:58 AM |
|
I figured it out! No errors on update yet the field became blank. I was inserted text in a Integer field. I needed to insert the record value froma table of status.
I applied your input on the record Id reference once verify I was updating correctly and it worked as expected. Such a releif, THANKS!
final SQL Statement:
sql="UPDATE roster SET Status = 2 where rosterid="&rosterid
_________________
Training and LMS Developer |
|
|
TheunisP
Posts: 342
|
Posted: 05/21/2012, 11:09 AM |
|
cool
|
|
|