I have table with 4 fields pkey,name,whosinfo_pkey,description.Here 'pkey' is autogenerated key. The sample values following here:
'75', 'Contact Dermatitis', '513', 'Contact Dermatitis'
'76', 'Anaphylaxis', '513', 'Anaphylaxis'
'77', 'Insect Venom', '513', 'Insect Venom'
'78', 'Atopic Dermatitis', '520', 'Atopic Dermatitis'
'79', 'Food Alergies', '520', 'Food Alergies'
'80', 'Insect Venom', '520', 'Insect Venom'
CREATE DEFINER=`root`@`%` PROCEDURE `SPUpdateMA`(in pkey varchar(45),
in DisName varchar(60)
)
BEGIN
UPDATE medicalhistory medhis
INNER JOIN whosinfo whos
ON whos.pkey=medhis.whosInfo_pkey
SET
medhis.name=DisName,
/*medhis.whosInfo_pkey=pkey,*/
medhis.description=DisName
WHERE medhis.whosInfo_pkey=pkey;
END
In update button click I use following code:try
{
if (whospkey == "")
{
}
else
{
//string patid = Request.QueryString["Ptid"];
for (int i = 0; i < CheckBoxList2.Items.Count; i++)
{
if (CheckBoxList2.Items[i].Selected == true)
{
objReg.Name = CheckBoxList2.Items[i].Text;
objReg.WhosInfo = whospkey;
// objReg.WhosInfo = Convert.ToString(ViewState["WhosInfo"]);
objRegLogic.UpdatePMedHis(objReg);
}
}
}
}
catch (Exception ex)
{
}
In design page,I use checkboxlist as following:
CssClass="CheckboxList" Width="100%" RepeatDirection="Horizontal" BorderColor="#3399FF">
Here the problem is,when I update this it will update all data like following:
'75', 'Contact Dermatitis', '513', 'Contact Dermatitis'
'76', 'Anaphylaxis', '513', 'Anaphylaxis'
'77', 'Insect Venom', '513', 'Insect Venom'
'78', 'Anaphylaxis', '520', 'Anaphylaxis'
'79', 'Anaphylaxis', '520', 'Anaphylaxis'
'80', 'Anaphylaxis', '520', 'Anaphylaxis'
But actually I check 3 checkboxes.It takes last checkbox value only Hives,Food Allergies,Anaphylaxis.How I overcome this?How can I update values here correctly?Can anyone help me?


Iftikar HussainRank #423 · 5.9K reputationPosted Aug 2, 2013, 3:33 AM EDT
How you are reading whospkey value? can you share that?
Regards,
Iftikar
Kavi sujaRank #6,237 · 272 reputationPosted Aug 2, 2013, 3:40 AM EDT
I read whospkey value from whosinfo table using stored procedure "SPEditPatient".The code is following:
}
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 2, 2013, 4:10 AM EDT
Regards,
Iftikar
Kavi sujaRank #6,237 · 272 reputationPosted Aug 2, 2013, 4:17 AM EDT
Can you explain it?I can't understand.
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 2, 2013, 4:20 AM EDT
Regards,
Iftikar