.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

Select Case - Represented by Images

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :ASP.Net
 
I have a question about a Select Case, and how to go about writting it. In my pages, I call to a SQL Database, that returns values from a column.  The columns present two types of data, numeric and varchar e.g 2N or .10 (they present nickles) I would like my onscreen to display images, instead of that value (once they have been found). Where 2N = imageNickle + imageNickle, as well as .10 = imageNickle + imageNickle (or display 2 of the images in place, rather) I would like to just focus on the (varchar) at this point.  Is their an easier way to write a select statement than say: Select Case howManyImages If columnValue = 2N then displayValue = "/imageNickle.jpg" & "/imageNickle.jpg" ElseIf columnValue = 3N Then displayValue = "/imageNickle.jpg" & "/imageNickle.jpg & "/imageNickle.jpg" or is this pretty simple as it is?      


View Complete Post


More Related Resource Links

Can we use Select clause in Case statement

  
SELECT CASE OT.ItemTypeID WHEN 6 THEN SELECT SUM(ISNULL("Item Cost",0)) FROM SUBTABLE IT WHERE IT.OrderID = OT.OrderID AND IT.ItemTypeID IN(6,11,12) WHEN 7 THEN SELECT SUM(ISNULL("Item Cost",0)) FROM SUBTABLE IT WHERE IT.OrderID = OT.OrderID AND IT.ItemTypeID IN(7,14,15) WHEN 8 THEN SELECT SUM(ISNULL("Item Cost",0)) FROM SUBTABLE IT WHERE IT.OrderID = OT.OrderID AND IT.ItemTypeID = 8 WHEN 9 THEN SELECT SUM(ISNULL("Item Cost",0)) FROM SUBTABLE IT WHERE IT.OrderID = OT.OrderID AND IT.ItemTypeID = 9 WHEN 10 THEN SELECT SUM(ISNULL("Item Cost",0)) FROM SUBTABLE IT WHERE IT.OrderID = OT.OrderID AND IT.ItemTypeID = 10 WHEN 11 THEN SELECT SUM(ISNULL("Item Cost",0)) FROM SUBTABLE IT WHERE IT.OrderID = OT.OrderID AND IT.ItemTypeID IN(6,11,12) WHEN 12 THEN SELECT SUM(ISNULL("Item Cost",0)) FROM SUBTABLE IT WHERE IT.OrderID = OT.OrderID AND IT.ItemTypeID IN(6,11,12) WHEN 14 THEN SELECT SUM(ISNULL("Item Cost",0)) FROM SUBTABLE IT WHERE IT.OrderID = OT.OrderID AND IT.ItemTypeID IN(7,14,15) WHEN 15 THEN SELECT SUM(ISNULL("Item Cost",0)) FROM SUBTABLE IT WHERE IT.OrderID = OT.OrderID AND IT.ItemTypeID IN(7,14,15) WHEN 18 THEN SELECT SUM(ISNULL("Item Cost",0)) FROM SUBTABLE IT WHERE IT.OrderID = OT.OrderID AND IT.ItemTypeID = 18 WHEN 19 THEN SELECT SUM(ISNULL(&qu

add more than one case in select statement ?

  

hi all

i have this select statement

select

case when X  = 1 THEN ''

ELSE

CASE WHEN y = 1 THEN 'Y' END

CASE WHEN f = e THEN 'ok' END

END

FROM table

but

Incorrect syntax near the keyword 'CASE' the secound one

how can i solve this ?


Possible to use CASE in select to select different columns/values?

  

Hey everyone,

I'm trying to work some SQL to work like the following (which doesn't work/isn't allowed). Is there a way in SQL to do this?

declare @mode int
set @mode = 1

Declare @Profiles varchar(400) 
set @Profiles=''

Declare @Count int

-- This is where it's tricky.
-- If mode is 1, then we want to return the count of the records.
-- If not, we want to return the values. 
-- What we don't want to do is have to write the entire select
-- statement twice. :-)
select case @mode
	when 1 then @Count=count(1) 
	else *
from CLACX x inner join

Use of CASE statement in Select using SqlDataSource

  

Hi All,

I need help regarding the use of CASE in Select of SQLDataSource. Actually I am using FORMVIEW and in the Grid i have "Consumer Numbers" as link and on click I save the Consumer Number in Session Variable. When user go into Edit and change the Consumer Number after updation the formview was coming blank cause i was using that number for select statement now. Just need to correct the SELECT and use the case properly and want to do is

"IF CONSUMER_NUMBER = <SESSION_VARIABLE_OF_CONSUMER_NO> THEN USE <SESSION VARIABLE>

ELSE

USE FIELD "CONSUMER NUMBER

How to do that please correct.


       <asp:SqlDataSource ID="SqlDSBillers" runat="server" 
ConnectionString="<%$ ConnectionStrings:SQLE2K8 %>"

SelectCommand="SELECT Bill_Master.Bill_Master_ID,
Bill_Master.Biller_ID,
CONVERT (varchar(20),
Bill_Master.Enroll_Date, 105) AS Enroll_Date,
Billers.Biller_Code,
Bill_Master.Consumer_No,
Bill_Master.NameOnConnection,

Problems with select case executing twice, Help?

  

Dear all, I have a problem with Select case. I want to invoke different sub procedures each time a button is clicked. I decided to use select  case (not sure this the right way to achieve this goal). Here is the code:


Protected Sub AddButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles AddButton.Click
Dim count as integer=1
Select Case count Case 1 AddFile1() Case 2 AddFile2() Case Else ShowMessage() End Select End sub

In each sub procedure except case else, I kept increaseing count by setting it to value 2. My problem is that after executing case 1, for some reasons, it keeps repeating itself to case 2. How can I stop it after case 1 is executed? Thank you very much.

 


Visual Case Tool - UML Tutorial

  
The Class Diagram

The class diagram is core to object-oriented design. It describes the types of objects in the system and the static relationships between them.

AJAX GridView Checkbox Select All in ASP.Net

  
In the previous article GridView Select Multiple Rows you learnt the multiple row selection in GridView control. Here you will get the C# code sample to select all the gridview rows using single checkbox server control. You can highlight the selected rows with different color and Font state Bold. If you want to use the selection values on different ASP.Net

Use Case Diagram

  
The use case diagram shows the functionality of the system from an outside-in viewpoint.

Actors (stick men) are anything outside the system that interacts with the system.

Images in WPF

  
How to create a Thumbnail of an Image. How to automatically crop an image. The following method allows you to automatically crop an image to it's content.

Reading and Writing Images From a Windows Mobile Database using UltraLite 10(C#)

  
Periodically I get a request for information on how to read and write binary data to a database running on Windows Mobile. If you search the Internet you can typically find examples that are available on Windows Desktops or allow you to read and write to a local file system. The problem is that it can take a bit of work to get this code to work on Windows Mobile accessing a database.

Ultimately you might be asking, why would I want to store and image in a database? Well in an environment where you synchronizing data between a local mobile database and a consolidated (central) database this can be extremely useful. Imagine if an insurance adjuster went to an accident scene, took a picture of a damaged car, loaded it into his Windows Mobile database and then replicated that image up to the Insurance headquarters for approval. All of this could be done in a very short period of time when using images in the database. Another good example might be a doctor who was waiting for a patient chart to become available. If you could store the image in a database this chart could be sent down to the doctor's device once it became available.

For this article I am not going to get into how to synchronize the images to and from a remote and central database as this is typically fairly straightforward when using a data synchronization technologies like MobiLink

Save images to SQL CE

  
Storing binary objects (such as image, office document etc.) into database is a little cumbersome when it comes to retrieval. Hence the most commonly accepted way is only store the file path in the database, and to store the documents on a file share.

Store and Display Images from MS Access Database Using C#

  
There is only the difference of coding syntax to stream the binary data of image content type to upload it into MS Access Database using C#/VB in ASP.Net 2.0

Namespaces required:-
using System.Data.OleDb;

OleDb is used to connect the web site forms with MS Access Database using Microsoft.Jet.OLEDB.4.0

Open File Print File Excel

  
Batch print many Excel files without having to open each one at a time. Quickly print mass amounts of xls files at once with this program. You must have Excel installed on your machine..
http://www.sharewareconnection.com/software.php?list=Open+File+Print+File+Excel

The Free Barcode Creator produces barcode images one at a time, and allows easy saving to a file or

  
The Free Barcode Creator produces barcode images one at a time, and allows easy saving to a file or pasting into an application. 2D versions are also available:

Browsing all Images in Directory ... ?! asp.net & C#

  

Hi every one ... How are you ??

OK ... I want to make album ... I try to make it using buttons( next & pre ) using imageButton control and variable (i)

So ... each next (++i) & pre ( --i) to show allimages in directory ("photo")

Here my code in C#  ::


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using System.IO;
using System.Collections.Generic;

namespace iThinkerWebSite
{
    public partial class photos : System.Web.UI.Page
    {

       // LinkedList<string> names = admin.getNames();
        DirectoryInfo dir;
        FileInfo[] files;
        static int i = -1;
        static int l = 0;

        protected void Page_Load(object sender, EventArgs e)
        {
            dir = new DirectoryInfo(MapPath("photo"));
            files = dir.GetFiles();
            //l = (int)names.LongCount();
            l = files.Length;
            if (l == 0)
            {
                Label2.Text = "No Photo to Display !!";
            }
            
            Image2.ImageUrl = "images/ith.png";
 

Select value in gridview

  

Hi, I am new to gridview. I want to make a gridview. Its row when selected should direct me to a specific .aspx page.Each row should direct to a different page. Should I use querystrings for this? Please suggest. Regards, ap.


Displaying Dicom images..........

  

Sir,

Please guide

  1. How to display Dicom images in .net web apllications.
  2. How can i convert Dicom images to Jpeg.
  3. Can uplease provide me with a sample web application??



Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend