stratosphere
Posts: 3
|
Posted: 07/24/2013, 2:05 AM |
|
Hi,
I'm new in using CodeCharge and would like to ask on how to get the value of a column in the database and display it in a textbox and also how to save that value on another table after clicking submit button.
This is the code that I used to get the value:
Function reimbursement_TextBox4_BeforeShow(Sender)
reimbursement.TextBox4.Value = CCDLookUp("sm_id","engineers","user_id=" & DBdbreimbursement.ToSQL(CCGetUserID(),ccsText), DBdbreimbursement)
End Function
I don't know if the code will lookup the correct row in my table to display the sm_id of that particular user.
table name: engineers
columns:
user_id - primary key
sm_id - need to get the value of this column.
Thanks in advance!
|
|
|
Oper
Posts: 1195
|
Posted: 07/24/2013, 2:18 AM |
|
ASP right?
look ok to me.
and after Excute Update or After Excute Insert
dim strsql,xv
xv=CCDLookUp("sm_id","engineers","user_id=" & DBdbreimbursement.ToSQL(CCGetUserID(),ccsText), DBdbreimbursement)
strsql="UPDATE whatevertable set xxxxx=" & xv & " where whatevercondition"
DBdbreimbursement.execute strsql
may has typo doit without check syntax
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
|
|
stratosphere
Posts: 3
|
Posted: 07/24/2013, 2:55 AM |
|
Hi Oper,
Right on ASP. How will I know if the value on BeforeShow code is correct? There were no errors but I cannot confirm if I'm getting values from it.
Will try the code for Excute Update or After Excute Insert and will get back to you once I'm done.
Thanks!
|
|
|
stratosphere
Posts: 3
|
Posted: 07/24/2013, 6:52 PM |
|
Hi Oper,
After clicking the submit button, the sm_id column is still null. Does it mean that the xv is not returning a value? Here is my code:
Quote :
Function reimbursement_DataSource_AfterExecuteInsert(Sender)
Dim xv,strsql
xv=CCDLookUp("sm_id","engineers","user_id=" & DBdbreimbursement.ToSQL(CCGetUserID(),ccsInteger), DBdbreimbursement)
strsql="UPDATE reimbursement set sm_id=" & xv & " where reimbursement_id="
DBdbreimbursement.execute strsql
End Function
^ Coded in Record:reimbursement after execute insert event
table: reimbursement
column:
sm_id - value of xv to be inserted here
reimbursement_id - primary key for reimbursement table. auto increment once submitted.
Thanks!
|
|
|
|