CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Custom MSSQL DB UPDATE

Print topic Send  topic

Author Message
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
View profile  Send private message
TheunisP

Posts: 342
Posted: 05/20/2012, 8:51 PM

perhaps this:

sql="UPDATE roster SET Status ='Attended' WHERE rosterid=6676"
View profile  Send private message
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
View profile  Send private message
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
View profile  Send private message
TheunisP

Posts: 342
Posted: 05/21/2012, 10:19 AM

copy & paste the updated section of code again please
View profile  Send private message
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
View profile  Send private message
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?

View profile  Send private message
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

View profile  Send private message
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
View profile  Send private message
TheunisP

Posts: 342
Posted: 05/21/2012, 11:09 AM

cool ;-)
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.