I have faced a situation that when i try to update a page. Some values can be updated while some cannot. I try to print the executed SQL query and get the following
1"UPDATE orders SET2cust_id=15,po_code='PO20060610',3po_amt=10000.0000,4add_charges=0,5commission='eeeeeee',6lab_charges=0,7fty_dis=0,8pay_trm='adasds',9cust_dis=0,10trade_trm_desc='',11curr_rate=1,12ship_expense=0,13shipmark='eng ship mard new2',14sidemark='Eng Side Mark new333'15,inner_box='Eng Inner Box new333',16confirmation='rend confirmation2',17contract='end contact23',18internal_remark='testing testing 26/6/2007 333',19rec_curr_rate=0,rec_amt=0,shipmark_attach='',20sidemark_attach='',inner_box_attach='',21ord_type=1,status=2,ord_confirm_code='',22commission_type=1,sidemark_lang='English',23curr_code='HKD',unit_code='PCS',24trade_trm='FOB Hong Kong',rec_curr='USD',25ord_date='2006/06/10', po_date='01/01/2007',exp_delivery_date='01/01/2007',26act_delivery_date='01/01/2007', pay_start_date='10/10/06',pay_end_date='10/10/06',upd_time='2007/03/15 15:41:14' WHERE ord_id=292;Set @.ord_id=292;"
The fields sidemark, inner_box, internal_remark cannot update, while others can.
I think it's really strange... since i have no idea why some can be updated while some others and the SQL seems to me is correct.
Please give me some advices on solving this.
Thank you.
If I run this query against the table (definition below) it all works and all of those fields are updated.
Perhaps there is a problem with the definition of the table - you can post the definition if you like and I'll test again with the same definition. I had to call my table orders2 as I tested in Northwind, which already has an orders table...
UPDATE orders2 SET
cust_id=15,po_code='PO20060610',
po_amt=10000.0000,
add_charges=0,
commission='eeeeeee',
lab_charges=0,
fty_dis=0,
pay_trm='adasds',
cust_dis=0,
trade_trm_desc='',
curr_rate=1,
ship_expense=0,
shipmark='eng ship mard new2',
sidemark='Eng Side Mark new333'
,inner_box='Eng Inner Box new333',
confirmation='rend confirmation2',
contract='end contact23',
internal_remark='testing testing 26/6/2007 333',
rec_curr_rate=0,rec_amt=0,shipmark_attach='',
sidemark_attach='',inner_box_attach='',
ord_type=1,status=2,ord_confirm_code='',
commission_type=1,sidemark_lang='English',
curr_code='HKD',unit_code='PCS',
trade_trm='FOB Hong Kong',rec_curr='USD',
ord_date='2006/06/10', po_date='01/01/2007',exp_delivery_date='01/01/2007',
act_delivery_date='01/01/2007', pay_start_date='10/10/06',pay_end_date='10/10/06',upd_time='2007/03/15 15:41:14' WHERE ord_id=1
CREATE TABLE [orders2] (
[ord_id] [int] IDENTITY (1, 1) NOT NULL ,
[cust_id] [int] NULL ,
[po_code] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[po_amt] [decimal](18, 2) NULL ,
[add_charges] [decimal](18, 2) NULL ,
[commission] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[lab_charges] [decimal](18, 2) NULL ,
[fty_dis] [decimal](18, 2) NULL ,
[pay_trm] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[cust_dis] [decimal](18, 2) NULL ,
[trade_trm_desc] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[curr_rate] [decimal](18, 2) NULL ,
[ship_expense] [decimal](18, 2) NULL ,
[shipmark] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[sidemark] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[inner_box] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[confirmation] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[contract] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[internal_remark] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[rec_curr_rate] [decimal](18, 2) NULL ,
[rec_amt] [decimal](18, 2) NULL ,
[shipmark_attach] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[sidemark_attach] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[inner_box_attach] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[ord_type] [int] NULL ,
[status] [int] NULL ,
[ord_confirm_code] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[commission_type] [int] NULL ,
[sidemark_lang] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[curr_code] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[unit_code] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[trade_trm] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[rec_curr] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[ord_date] [datetime] NULL ,
[po_date] [datetime] NULL ,
[exp_delivery_date] [datetime] NULL ,
[act_delivery_date] [datetime] NULL ,
[pay_start_date] [datetime] NULL ,
[pay_end_date] [datetime] NULL ,
[upd_time] [datetime] NULL ,
CONSTRAINT [PK_orders2] PRIMARY KEY CLUSTERED
(
[ord_id]
) ON [PRIMARY]
) ON [PRIMARY]
GO
Your orders is a table or View? Do you receive any specific error?
Thanks
|||orders2 is a table.
I didn't get any errors and the update was sucessful.
|||I see that yours is tableSohnee ,but the object orders with whichthtang has a problem is a table or view?
No comments:
Post a Comment