have a stored procdeure for updating or inserting records in tbl1
along with it i need to update/ insert records having a common id in TBLIMG , I NEED to store the image name in the field if the image is selected from the asp.net application
but if no image selection is done then i need to store a default image which is stored in a folder
i have 2 default image based on gender selection
if gender=M defaultimg1 and if F defaultimg2
how do i check and write the condition fr the same in SP
svibuk
Member
717 Points
1736 Posts
storing image from stored procedure
Jan 17, 2013 04:06 AM|LINK
have a stored procdeure for updating or inserting records in tbl1
along with it i need to update/ insert records having a common id in TBLIMG , I NEED to store the image name in the field if the image is selected from the asp.net application
but if no image selection is done then i need to store a default image which is stored in a folder
i have 2 default image based on gender selection
if gender=M defaultimg1 and if F defaultimg2
how do i check and write the condition fr the same in SP
g_mani
Contributor
2055 Points
586 Posts
Re: storing image from stored procedure
Jan 17, 2013 05:32 AM|LINK
in your SP,
Select gender,TBLIMG from tablename where userid=@userid
load records into a datatable by SqlDataAdapter and do simple check like,
if(!string.IsNullOrEmpty(dt.Rows[0]["TBLIMG"].ToString())) { img.src=dt.Rows[0]["TBLIMG"].ToString(); } else if(dt.Rows[0]["gender"].ToString().ToUpper()=="MALE") { img.src=default1.jpg } else { img.src=default2.jpg }Please Mark as Answer If this is helpful.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: storing image from stored procedure
Jan 19, 2013 01:47 AM|LINK
Hi,
You can use something like this following to do the conditional choices:
<%#Eval("BoundFieldName").ToString()=="SomeValue"?"Value1":"Value2"%>