473,473 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

If Statement logic

maylortaylor
72 New Member
So I have two If statements and an overloaded function that needs to be used. I can't seem to figure out the logic for how to get this to work as i want it.

Expand|Select|Wrap|Line Numbers
  1.  If IsDBNull(orderstable.Rows(0).Item("ZipCode")) Then
  2.                     CanBeAssigned(orderstable.Rows(0).Item("County"), orderstable.Rows(0).Item("State"), orderstable.Rows(0).Item("Status").ToString.ToUpper)
  3.                 Else
  4.  
  5.  
  6.                     If CanBeAssigned(orderstable.Rows(0).Item("ZipCode"), orderstable.Rows(0).Item("Status").ToString.ToUpper) Then
  7. ''LOTS OF CODE THAT I DONT WANT TO POST''
  8.  
Ideally, I want the first IF to check if 'ZipCode' is Null...if it is > it uses the CanBeAssigned(county,state,status) function and then does the ''LOTS OF CODE THAT I DONT WANT TO POST'' ...

...however, if 'ZipCode' is NOT NULL then it uses the CanBeAssigned(zipcode,status) and then proceeds to do the''LOTS OF CODE THAT I DONT WANT TO POST'' .
Apr 16 '13 #1
3 1173
Rabbit
12,516 Recognized Expert Moderator MVP
I can't seem to figure out the logic for how to get this to work as i want it.
We can't figure it out either because you haven't explained how you want it to work.
Apr 16 '13 #2
Killer42
8,435 Recognized Expert Expert
Looks to me as though you need to put your End If right after line 6, and remove the IF test on line 6. Something like...
Expand|Select|Wrap|Line Numbers
  1. If IsDBNull(orderstable.Rows(0).Item("ZipCode")) Then
  2.   CanBeAssigned(orderstable.Rows(0).Item("County"), orderstable.Rows(0).Item("State"), orderstable.Rows(0).Item("Status").ToString.ToUpper)
  3. Else
  4.   CanBeAssigned(orderstable.Rows(0).Item("ZipCode"), orderstable.Rows(0).Item("Status").ToString.ToUpper)
  5. End If
  6. ''LOTS OF CODE THAT I DONT WANT TO POST''
  7.  
Sorry if I've misunderstood the question.
Jul 20 '13 #3
Killer42
8,435 Recognized Expert Expert
Huh?

Apart from being unindented and not flagged as code, that's exactly what I posted.

Edit: Looks like the offending post has been removed, leaving this comment looking silly. Wish I could delete it.
Jul 23 '13 #4

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

Similar topics

3
by: Bartosz Wegrzyn | last post by:
I am trying to upload images using either exec command. The file is uploaded ok. My script: <html> <head> <title>Picture Upload Page</title> <?php if ($_POST=="upload") {
11
by: Paul Rubin | last post by:
I frequently find myself writing stuff like # compute frob function, x has to be nonnegative x = read_input_data() assert x >= 0, x # mis-use of "assert" statement frob = sqrt(x)...
1
by: robert | last post by:
hi! there's a line in my Javascript program that makes a change in the appearance of an area of the screen. it is a game program, so there are a cascade of changes after the user makes a move....
94
by: John Bailo | last post by:
The c# *return* statement has been bothering me the past few months. I don't like the fact that you can have different code paths in a method and have multiple return statements. To me, it...
3
by: Roy Adams | last post by:
Hello everyone I'm doing a multiple insert from ten text fields. all named color when I submit the from with the text fields it goes to an asp page with the script to do the job and the go to...
41
by: Mark R. Dawson | last post by:
I have never used a goto statement in my code, one of the first things I was told in my software classes a number of years ago was "goto statements are evil and lead to spagetti code - do not use...
3
by: sck10 | last post by:
Hello, I am trying to use an If Then statement inside of a repeater control. However, I am getting the following error: Expression expected. Any help would be appreciated. Thanks in...
3
by: sck10 | last post by:
Hello, Currently, I have two web.config files on different machines (test and production). The only difference between the two is that the connectionstring and appsettings point to different...
8
by: nano2k | last post by:
Hi Shortly, I keep invoices in a table. Occasionally, someone will fire the execution of a stored procedure (SP) that performs several UPDATEs against (potentially) all invoices OLDER than a...
22
by: pbd22 | last post by:
hi. I am having probelms with an update statement. every time i run it, "every" row updates, not just the one(s) intended. so, here is what i have. i have tried this with both AND and OR and...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.