annnkay
|
| Posted: 02/09/2002, 1:32 PM |
|
emm... i'm working on my update pages.the pages is generate without error but when i use the page it's seem to work properly .....but then it doesn't because when i look into the database it seem the new info that i update never been sent to the database......what might cause it.my coding... ????
this is the sql statement that i wrote....case iupdateAction:
sSQL = "update member_detail set " +
"member_id=" + toSQL(fldmember_id, adText) +
",user_type=" + toSQL(flduser_type, adNumber) +
",login=" + toSQL(fldlogin, adText) +
",password=" + toSQL(fldpassword, adText) +
",fname=" + toSQL(fldfname, adText) +
",lname=" + toSQL(fldlname, adText) +
",noic=" + toSQL(fldnoic, adText) +
",address=" + toSQL(fldaddress, adText) +
",city=" + toSQL(fldcity, adText) +
",postcode=" + toSQL(fldpostcode, adText) +
",country=" + toSQL(fldcountry, adText) +
",phone=" + toSQL(fldphone, adText) +
",fax=" + toSQL(fldfax, adText) +
",email=" + toSQL(fldemail, adText) +
",tel_ext=" + toSQL(fldtel_ext, adText) +
",building_no=" + toSQL(fldbuilding_no, adText) +
",room_no=" + toSQL(fldroom_no, adText);
sSQL = sSQL + " where " + sWhere;
break;
please help.........
|
|
|
 |
Kris
|
| Posted: 02/09/2002, 2:22 PM |
|
It is probably with your where clause.
what do you have in your sWhere variable?
|
|
|
 |
annnkay
|
| Posted: 02/09/2002, 2:29 PM |
|
my sWhere go like ....
if ( iAction == iupdateAction || iAction == ideleteAction ) {
pPKmember_id = getParam( request, "PK_member_id");
if ( isEmpty(pPKmember_id)) return sDetailErr;
sWhere = "member_id=" + toSQL(pPKmember_id, adText);
are they wrong..?
|
|
|
 |
Kris
|
| Posted: 02/09/2002, 3:12 PM |
|
Try hardcoding the pPKmember_id in your where clause.
Force a value from the table just prior to your sWhere statement.
For example: pPKmember_id = 100 for number or "100" if char field and
see whether it updates for that record. If that works, then your are getting the parm correctly. Let's see.
|
|
|
 |
annnkay
|
| Posted: 02/10/2002, 12:16 PM |
|
hi kris...can u help me again...i have this form of borrowing book. and in my data base there are my data about the date of borrowing,due date and return date.i have a form that insert my date of borrowing and due date.and the other form that insert my return date.my problem is when i insert in the form that insert my return date,it insert a new data in my database.what when wrong....and can i write my code like this or not...
case iinsertAction :
sSQL = "insert into borrowing (" +
"borrower_id," +
"resource_id," +
"start_date," +
"due_date," +
"status," +
"return_date," +
"remarks)" +
" values (" +
toSQL(fldborrower_id, adText) + "," +
toSQL(fldresource_id, adText) + "," +
toSQL(fldstart_date, adText) + "," +
toSQL(flddue_date, adText) + "," +
toSQL(fldstatus, adText) + "," +
toSQL(fldreturn_date, adText) + "," +
toSQL(fldremarks, adText) + ")";
break;
case iupdateAction:
sSQL = "update member_detail set " +
"borrowing_id=" + toSQL(fldborrowing_id, adText) +
",resource_id=" + toSQL(fldresource_id, adText) +
",return_date=" + toSQL(fldreturn_date,adText);
sSQL = sSQL + " where " + sWhere;
sSQL = sSQL + " where " + sWhere;
break;
|
|
|
 |
Kris
|
| Posted: 02/10/2002, 7:55 PM |
|
Annnkay,
When you click on update it inserts a record with the return date instead of updating an existing record, right?
Are you using CodeCharge? and what database?
This should be very easy if you use CodeCharge. Can you send me your CC and database if it is Access?
kris@influentialtech.com
|
|
|
 |
|