473,322 Members | 1,241 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

ELSE IF statements

Hi I have a stored procedure which returns DBNULL if "Line" is empty rather than returning EquipmentNumber:

Expand|Select|Wrap|Line Numbers
  1. IF EXISTS (SELECT Line FROM Equipment WHERE Department = @Department)
  2.  
  3. SELECT DISTINCT Line FROM Equipment WHERE Department = @Department
  4.  
  5. ELSE 
  6.  
  7. SELECT DISTINCT EquipmentNumber FROM Equipment WHERE Department = @Department
  8.  
Error messege "Unable to cast object of type 'System.DBNull' to type 'System.String'."
Mar 14 '09 #1
0 880

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Brittany | last post by:
can someone explain to me what if else staments do and what while statements do.
11
by: dmbkiwi | last post by:
I am new to this group, and relatively new to python programming, however, have encountered a problem I just cannot solve through reading the documentation, and searching this group on google. I...
33
by: Diez B. Roggisch | last post by:
Hi, today I rummaged through the language spec to see whats in the for ... else: for me. I was sort of disappointed to learn that the else clauses simply gets executed after the loop-body -...
6
by: Bart Nessux | last post by:
Should an if statement have a corresponding else statement? Or, is it OK to have an if statement by itself. For completeness, it seems the two should be together, but from experience I know that a...
27
by: Ron Adam | last post by:
There seems to be a fair amount of discussion concerning flow control enhancements lately. with, do and dowhile, case, etc... So here's my flow control suggestion. ;-) It occurred to me (a...
3
by: Patrice | last post by:
Hi, I need to do multi-conditional statements like below, but this error is displayed : Expected 'End' /myFilepath, line x else response.write(arrCorpo(sparam,sdiv)) end if I don't...
3
by: Amy | last post by:
Hi, I have 6 If Then Else statements I was supposed to write. I did so but I know that they have to be wrong because they all look the same. Could someone take a look at them and point me in the...
2
by: pradeep.thekkottil | last post by:
I'm setting up an auction website using PHP and MySQL. There in the section where logged in members can put up new auction in a form, I want to run a form validation where I used if else statements...
23
by: bearophileHUGS | last post by:
So far in Python I've almost hated the 'else' of the 'for' loops: - I have problems to remember its meaning; - It gives me little problems when I later want to translate Python code to other...
4
by: Tangleman | last post by:
I have a schema that defines a programming language for a script that drives a sequentially executing process. It defines the structure of a script that has to interact with a pre-existing,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.