Hi there,
Not sure if any one has experienced this before and can tell me what's
wrong with this statement:
if verified = false then dataObjects.Has Error = true
This is all on one line and verified is defined as a boolean variable.
Irrespective if verified is set to true or false in ALWAYS executes
dataObjects.Has Error = true.
Following code works as expected and dataObjects.Has Error = true
executes only if verified is set to false.
if verified = false then
dataObjects.Has Error = true
end if
To top it all of, I use the construct
if [expression] then [do something]
at other places in the program and it works fine.
Any ideas?
Thomas Born
Nov 21 '05
10 1206
Cor,
I was going to write back and say that the Finally block had nothing to do
with it. (Just happened to be in my example). But when I tried it without
the Finally, it doesn't do it! It is CRAZY! :^)
Greg
"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:uf******** *****@tk2msftng p13.phx.gbl... Greg,
It was exactly as you said yesterday what you said and thought that I got not that behaviour, tomorrow I get it, with this as well, \\\ Try Catch ex As Exception Finally If 0 = 1 Then MessageBox.Show ("hello") End Try /// And only in the Finnally block, and it will not be exectuted, it shows it is executed.
In your example it can be the right situation when this error on the open. However in this case, when I set it in a three line If statement, it behaves in another way as you said, crazy.
Cor
I just tried you exact code and it behaves the same whether I disable the first close or not.
Understand, nobody is disputing that if the connection is already closed
it will NOT try and close it again. The code works properly.
It is simpy this; if you step through with the debugger it ALWAYS highlights that cn.Close on the other side of the Then. It appears that it is exectuing it, whether it is or not.
Make sense? I added a screen shot (and simplified the If expression)
Greg
"Cor Ligthert" <no**********@p lanet.nl> wrote in message news:OW******** ******@TK2MSFTN GP12.phx.gbl... > Greg, > > I changed it to this, > > \\\ > Dim cn As New OleDb.OleDbConn ection("Provide r=Microsoft.Jet .OLEDB.4.0;Data > Source=C:\whate ver.mdb") > cn.Open() > cn.Close() > Try > Catch ex As Exception > Finally > If Not cn Is Nothing AndAlso cn.State = ConnectionState .Open > Then cn.Close() > End Try > /// > I have a different behaviour when I disable that first close. > > Cor > >> No, you got to do my example. The problem is when If Then is one >> line, >> no >> End If. >> >> You won't be able to throw in a messagebox like you are trying. You will >> have to step through with the debugger. >> >> If Not cn Is Nothing AndAlso cn.State = ConnectionState .Open Then > cn.Close() >> <-- all one line >> >> >> Greg >> >> >> "Cor Ligthert" <no**********@p lanet.nl> wrote in message >> news:Ol******** ******@TK2MSFTN GP12.phx.gbl... >> > Greg >> > I tried this and no strange results >> > >> > \\\ >> > Dim cn As New > OleDb.OleDbConn ection("Provide r=Microsoft.Jet .OLEDB.4.0;Data >> > Source=C:\whate ver.mdb") >> > cn.Open() >> > cn.Close() >> > Try >> > Catch ex As Exception >> > Finally >> > If Not cn Is Nothing AndAlso cn.State = ConnectionState .Open >> > Then >> > MessageBox.Show ("Is showed when cn.close is >> > disabled") >> > End If >> > End Try >> > /// >> > >> > >> >> > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Markus Franz |
last post by:
Hi.
Today I created a script called load.py for using at the command line
written in Python 2.3.
This script should load as many websites as given on the comand line and
print them with a seperation string to stdout. The loading was done in
parallel. (I used processes for this.)
The script was started by the following command:
|
by: Neil |
last post by:
I have a strange situation. I have a stored procedure that is hanging upon
execution, but only some machines and not others. The db is an Access 2000
MDB using ODBC linked tables and a SQL 7 back end. The sp is executed as a
pass-through.
The sp is fairly simple:
UPDATE CUSTOMER
SET LastMergeName = .
FROM (CUSTOMER C INNER JOIN MergeItems I ON C. = I.)
|
by: Bruno van Dooren |
last post by:
Hi All,
i have some (3) different weird pointer problems that have me stumped. i
suspect that the compiler behavior is correct because gcc shows the same
results.
----------------------------------------------
//example 1:
typedef int t_Array;
int main(int argc, char* argv)
|
by: DeltaOne |
last post by:
#include<stdio.h>
typedef struct test{
int i;
int j;
}test;
main(){
test var;
var.i=10;
var.j=20;
|
by: Hatul Shilgy |
last post by:
Hi
I'm facing a very strange problem here. My code looks like this
if(A == null
return
doSomethingWith(A.b)
When I run my code (in debug mode), I get a NullReferenceException -- and on breaking, I discover that A is indeed null. (The exception is raised in the doSomethingWith line.
| |
by: Praveen_db2 |
last post by:
Hi All
db2 8.1.3 Windows
I have folowing table structures
CREATE TABLE tb_RTB(
EMP_ID INTEGER,
DESC VARCHAR(20));
CREATE TABLE tb_ERROR(
SQL_STATE CHAR(5),
SQL_DESC VARCHAR(20),
|
by: g.ankush1 |
last post by:
#include <stdio.h>
/* 1st example
int a()
{
return 1;
}
|
by: matthewperpick |
last post by:
Check out this toy example that demonstrates some "strange" behaviour
with keyword arguments and inheritance.
=================================
class Parent:
def __init__(self, ary = ):
self.ary = ary
def append(self):
|
by: Dox33 |
last post by:
I ran into a very strange behaviour of raw_input().
I hope somebody can tell me how to fix this.
(Or is this a problem in the python source?)
I will explain the problem by using 3 examples. (Sorry, long email)
The first two examples are behaving normal, the thirth is
strange.......
I wrote the following flabbergasting code:
#-------------------------------------------------------------
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |