我在使用sqldatasource与Oracle数据库绑定更新表单视图值时遇到问题。
我的选择和插入事件正常工作,所有列和参数都正确。
但当我点击更新按钮时,会出现错误:
“ORA-01036:非法变量名称/号码”
这是我在 sqldatasource中使用的更新命令(与oracle绑定):
UPDATE REPORT_PINK
SET DEMOG_HEIGHT = :DEMOG_HEIGHT
, DEMOG_WEIGHT = :DEMOG_WEIGHT
, DEMOG_TX_NO = :DEMOG_TX_NO
, DEMOG_TX_PLACE = :DEMOG_TX_PLACE
, DEMOG_TX_DATE = :DEMOG_TX_DATE
, DEMOG_TX_TYPE = :DEMOG_TX_TYPE
, DEMOG_RELATIONSHIP = :DEMOG_RELATIONSHIP
, MED_HIS_CAUSE = :MED_HIS_CAUSE
, MED_HIS_ALLERGY = :MED_HIS_ALLERGY
, MED_HIS_BIOPSY_DATE = :MED_HIS_BIOPSY_DATE
, MED_HIS_DIALYSIS = :MED_HIS_DIALYSIS
, MED_HIS_DIALYSIS_DATE = :MED_HIS_DIALYSIS_DATE
, MED_HIS_PREV_TX_FIRST = :MED_HIS_PREV_TX_FIRST
, MED_HIS_PREV_TX_DATE_FIRST = :MED_HIS_PREV_TX_DATE_FIRST
, MED_HIS_PREV_TX_SECOND = :MED_HIS_PREV_TX_SECOND
, MED_HIS_PREV_TX_DATE_SECOND = :MED_HIS_PREV_TX_DATE_SECOND
, COMOR_HEART = :COMOR_HEART
, COMOR_LIVER = :COMOR_LIVER
, COMOR_HEPATITIS_B = :COMOR_HEPATITIS_B
, COMOR_HEPATITIS_C = :COMOR_HEPATITIS_C
, COMOR_DIABETES = :COMOR_DIABETES
, COMOR_TB = :COMOR_TB
, COMOR_PEPTIC = :COMOR_PEPTIC
, COMOR_CANCER = :COMOR_CANCER
, IMM_CDC_DATE = :IMM_CDC_DATE
, IMM_CDC_NORMAL_T = :IMM_CDC_NORMAL_T
, IMM_CDC_NORMAL_B = :IMM_CDC_NORMAL_B
, IMM_CDC_DTT_B = :IMM_CDC_DTT_B
, IMM_CDC_DTT_T = :IMM_CDC_DTT_T
, IMM_CDC_AHG_B = :IMM_CDC_AHG_B
, IMM_CDC_AHG_T = :IMM_CDC_AHG_T
, IMM_FLOW_DATE = :IMM_FLOW_DATE
, IMM_FLOW_IGGT_PAT = :IMM_FLOW_IGGT_PAT
, IMM_FLOW_IGGT_PRO = :IMM_FLOW_IGGT_PRO
, IMM_FLOW_IGGB_PAT = :IMM_FLOW_IGGB_PAT
, IMM_FLOW_IGGB_PRO = :IMM_FLOW_IGGB_PRO
, IMM_FLOW_IGMT_PAT = :IMM_FLOW_IGMT_PAT
, IMM_FLOW_IGMB_PAT = :IMM_FLOW_IGMB_PAT
, IMM_ANTI_HLA_PRA = :IMM_ANTI_HLA_PRA
, IMM_ANTI_HLA_PRA_DATE = :IMM_ANTI_HLA_PRA_DATE
, TC_REMUZZI_GLOMERULI_L = :TC_REMUZZI_GLOMERULI_L
, TC_REMUZZI_TUBULE_L = :TC_REMUZZI_TUBULE_L
, TC_REMUZZI_INTERSTITM_L = :TC_REMUZZI_INTERSTITM_L
, TC_REMUZZI_ARTERIS_L = :TC_REMUZZI_ARTERIS_L
, TC_REMUZZI_GLOMERULI_R = :TC_REMUZZI_GLOMERULI_R
, TC_REMUZZI_TUBULE_R = :TC_REMUZZI_TUBULE_R
, TC_REMUZZI_INTERSTITM_R = :TC_REMUZZI_INTERSTITM_R
, TC_REMUZZI_ARTERIS_R = :TC_REMUZZI_ARTERIS_R
, TC_ANAST_ARTERY = :TC_ANAST_ARTERY
, TC_ANAST_VEIN = :TC_ANAST_VEIN
, TC_ANAST_URETER = :TC_ANAST_URETER
, TC_DONATE_FIRST_ISCHEMIC = :TC_DONATE_FIRST_ISCHEMIC
, TC_DONATE_SECOND_ISCHEMIC = :TC_DONATE_SECOND_ISCHEMIC
, TC_DONATE_COLD_ISCHEMIC = :TC_DONATE_COLD_ISCHEMIC
, TC_DONATE_PERFUSION = :TC_DONATE_PERFUSION
, DONOR_NAME = :DONOR_NAME
, DONOR_NRIC = :DONOR_NRIC
, DONOR_GENDER = :DONOR_GENDER
, DONOR_AGE = :DONOR_AGE
, DONOR_DEATH = :DONOR_DEATH
, DONOR_INOTROPES = :DONOR_INOTROPES
, DONOR_ISHYPER = :DONOR_ISHYPER
, DONOR_HYPER = :DONOR_HYPER
, DONOR_ISDIABETES = :DONOR_ISDIABETES
, DONOR_DIABETES = :DONOR_DIABETES
, DONOR_ISOTHERS = :DONOR_ISOTHERS
, DONOR_OTHERS = :DONOR_OTHERS
, DONOR_UREA = :DONOR_UREA
, DONOR_CREAT = :DONOR_CREAT
, DONOR_HB = :DONOR_HB
, DONOR_PT = :DONOR_PT
, DONOR_PTT = :DONOR_PTT
, VIRO_HBSAG_RECP = :VIRO_HBSAG_RECP
, VIRO_HBSAG_RECP_DATE = :VIRO_HBSAG_RECP_DATE
, VIRO_ANTI_HB_RECP = :VIRO_ANTI_HB_RECP
, VIRO_ANTI_HB_RECP_DATE = :VIRO_ANTI_HB_RECP_DATE
, VIRO_ANTI_HBC_RECP = :VIRO_ANTI_HBC_RECP
, VIRO_ANTI_HBC_RECP_DATE = :VIRO_ANTI_HBC_RECP_DATE
, VIRO_HBV_RECP = :VIRO_HBV_RECP
, VIRO_HBV_RECP_DATE = :VIRO_HBV_RECP_DATE
, VIRO_ANTI_HCV_RECP = :VIRO_ANTI_HCV_RECP
, VIRO_ANTI_HCV_RECP_DATE = :VIRO_ANTI_HCV_RECP_DATE
, VIRO_HIV_AG_RECP = :VIRO_HIV_AG_RECP
, VIRO_HIV_AG_RECP_DATE = :VIRO_HIV_AG_RECP_DATE
, VIRO_HIV_PCR_RECP = :VIRO_HIV_PCR_RECP
, VIRO_HIV_PCR_RECP_DATE = :VIRO_HIV_PCR_RECP_DATE
, VIRO_CMV_RECP = :VIRO_CMV_RECP
, VIRO_CMV_RECP_DATE = :VIRO_CMV_RECP_DATE
, VIRO_VDRL_RECP = :VIRO_VDRL_RECP
, VIRO_VDRL_RECP_DATE = :VIRO_VDRL_RECP_DATE
, VIRO_ABO_RECP = :VIRO_ABO_RECP
, VIRO_ABO_RECP_DATE = :VIRO_ABO_RECP_DATE
, VIRO_HCV_PCR_RECP = :VIRO_HCV_PCR_RECP
, VIRO_HCV_PCR_RECP_DATE = :VIRO_HCV_PCR_RECP_DATE
, VIRO_HBSAG_DONOR = :VIRO_HBSAG_DONOR
, VIRO_HBSAG_DONOR_DATE = :VIRO_HBSAG_DONOR_DATE
, VIRO_ANTI_HB_DONOR = :VIRO_ANTI_HB_DONOR
, VIRO_ANTI_HB_DONOR_DATE = :VIRO_ANTI_HB_DONOR_DATE
, VIRO_ANTI_HBC_DONOR = :VIRO_ANTI_HBC_DONOR
, VIRO_ANTI_HBC_DONOR_DATE = :VIRO_ANTI_HBC_DONOR_DATE
, VIRO_HBV_DONOR = :VIRO_HBV_DONOR
, VIRO_HBV_DONOR_DATE = :VIRO_HBV_DONOR_DATE
, VIRO_ANTI_HCV_DONOR = :VIRO_ANTI_HCV_DONOR
, VIRO_ANTI_HCV_DONOR_DATE = :VIRO_ANTI_HCV_DONOR_DATE
, VIRO_HCV_PCR_DONOR = :VIRO_HCV_PCR_DONOR
, VIRO_HCV_PCR_DONOR_DATE = :VIRO_HCV_PCR_DONOR_DATE
, VIRO_HIV_AG_DONOR = :VIRO_HIV_AG_DONOR
, VIRO_HIV_AG_DONOR_DATE = :VIRO_HIV_AG_DONOR_DATE
, VIRO_HIV_PCR_DONOR = :VIRO_HIV_PCR_DONOR
, VIRO_HIV_PCR_DONOR_DATE = :VIRO_HIV_PCR_DONOR_DATE
, VIRO_CMV_DONOR = :VIRO_CMV_DONOR
, VIRO_CMV_DONOR_DATE = :VIRO_CMV_DONOR_DATE
, VIRO_VDRL_DONOR = :VIRO_VDRL_DONOR
, VIRO_VDRL_DONOR_DATE = :VIRO_VDRL_DONOR_DATE
, VIRO_ABO_DONOR = :VIRO_ABO_DONOR
, VIRO_ABO_DONOR_DATE = :VIRO_ABO_DONOR_DATE
, HLA_A1_RECP = :HLA_A1_RECP
, HLA_A2_RECP = :HLA_A2_RECP
, HLA_B1_RECP = :HLA_B1_RECP
, HLA_B2_RECP = :HLA_B2_RECP
, HLA_DR1_RECP = :HLA_DR1_RECP
, HLA_DR2_RECP = :HLA_DR2_RECP
, HLA_ANTITITRE_RECP = :HLA_ANTITITRE_RECP
, HLA_A1_DONOR = :HLA_A1_DONOR
, HLA_A2_DONOR = :HLA_A2_DONOR
, HLA_B1_DONOR = :HLA_B1_DONOR
, HLA_B2_DONOR = :HLA_B2_DONOR
, HLA_DR1_DONOR = :HLA_DR1_DONOR
, HLA_DR2_DONOR = :HLA_DR2_DONOR
, HLA_ANTITITRE_DONOR = :HLA_ANTITITRE_DONOR
WHERE PAT_ID = :PAT_ID
我的问题已解决,因为我没有使用主键来匹配where条件,当我使用主键更改where条件时它开始工作。
在使用sqldatasource(或使用oracle)时,是否必须使用主键给出where条件,因为通常我们可以在手动操作时将任何where条件置于更新记录中。
答案 0 :(得分:5)
是的,我认为必须使用主键才能使用SqlDataSource触发更新查询。如果您将SqlDataSource与Oracle,SQL Server或任何其他数据源一起使用,则不会这样做。
原因可能是SqlDataSource只允许一次编辑一条记录,因此更改只会反映一条记录而不会超过一条记录。