1

I have 2 sql tables

 items with the desgin:
 minBuy (int number)



 purchase with the desgin:
id

At items i have column "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?

1
  • are you returning purchase ID , min buy and i from db? Commented Jun 1, 2011 at 11:51

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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";

3 Comments

the if statement is the easy part, but how i do it to sql tables.
I think you need to elaborate a little bit...when I look at the names of the variables, it looks like you are comparing an ID number to a price... so maybe explain what is what.
ok, what i need to do is - i have page.aspx , i have label that shown what is the minimum number (from item table) to open the auoction ... i.e the minimum number is 5... after i got 5 bids (table: purchase) - the auoction start and at other lablel shown img: V.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.