= to minBuy, i wan" />
开发者

if statement on sql c# asp.net

开发者 https://www.devze.com 2023-03-09 22:34 出处:网络
I have 2 sql tables items with the desgin: minBuy (int number) purchase with the desgin: id At items i have c开发者_开发知识库olumn \"minBuy\" - as long as purchase id not >= to minBuy, i wan

I have 2 sql tables

 items with the desgin:
 minBuy (int number)



 purchase with the desgin:
id

At items i have c开发者_开发知识库olumn "minBuy" - as long as purchase id not >= to minBuy, i want to show img that display "X". when it's >= i want to display img that shown "V". i'm using sql with c#.

i have the two img's .... v.png and x.png.

how can i do that at c# with

  if(purchaseid >= minBuy)

   v.visble = true; 

i heard somthing about to do fetch, what is it and how that can help me here?


You can do that with a case statement. For example:

CASE WHEN purchaseid >= minBuy THEN 1 ELSE 0 END as MinBuyInd

Now you can use the MinBuyInd column to determine which image to display.


if you have an asp:Image ID="img" tag.

than you can just set the source

 if(purchaseid >= minBuy)
   img.ImageUrl = "url of V";
else
   img.ImageUrl = "url of X";
0

精彩评论

暂无评论...
验证码 换一张
取 消