473,320 Members | 1,699 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,320 software developers and data experts.

With Clause

I have come to greatly respect both Herfried & Cor's reponses and since the
two conflicted, I wanted to get some clarification.

My orginal post:
Herfried, maybe your example here can get you to answer a question I've
wondered about for a while.

With Me.Label1
.Text = ...
.Refresh()
End With

The idea behind the With clause is it allows for faster execution since
the "Me" ojbect doesn't have to be resolved 2 times in your example. But
you could rewrite your sample w/o the Me

With Label1
.Text = ...
.Refresh()
End With

In this case there wouldn't be any inhancement since you are not actually
eliminating the dot. Am I correct in my thinking?

Herfried's response
The 'Me.' is resolved even if it's not explicitly written. In this case I
used With type the code faster ;-).

Cor's Reposnse
The "Me" is only for the programmer, it does nothing at runtime.
The With clause creates an extra reference in a program. In this case it
will be slower than a program without a With clause, however think than
probably in parts of nanoseconds.
I hope this gives some ideas?


Nov 21 '05 #1
27 4659
Chris,

Here the IL code from this program (I had it already ready when Herfried
would react however he did not) ;-)

Public Sub test()
With Me.label1
.Text = "Me"
.Refresh()
End With
With label1
.Text = "without Me"
.Refresh()
End With
label1.Text = "without With"
label1.Refresh()

End Sub
\\
IL_0000: ldarg.0
IL_0001: ldfld class
[System.Windows.Forms]System.Windows.Forms.Label Testje.Class1::label1
IL_0006: stloc.1
IL_0007: ldloc.1
IL_0008: ldstr "Me"
IL_000d: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::set_Text(string)
IL_0012: ldloc.1
IL_0013: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::Refresh()
IL_0018: ldnull
IL_0019: stloc.1
IL_001a: ldarg.0
IL_001b: ldfld class
[System.Windows.Forms]System.Windows.Forms.Label Testje.Class1::label1
IL_0020: stloc.0
IL_0021: ldloc.0
IL_0022: ldstr "without Me"
IL_0027: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::set_Text(string)
IL_002c: ldloc.0
IL_002d: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::Refresh()
IL_0032: ldnull
IL_0033: stloc.0
IL_0034: ldarg.0
IL_0035: ldfld class
[System.Windows.Forms]System.Windows.Forms.Label Testje.Class1::label1
IL_003a: ldstr "without With"
IL_003f: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::set_Text(string)
IL_0044: ldarg.0
IL_0045: ldfld class
[System.Windows.Forms]System.Windows.Forms.Label Testje.Class1::label1
IL_004a: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::Refresh()
IL_004f: ret
///
Nov 21 '05 #2
But if you look at it another way, if you consider a access to a property as
multiple levels of indirection of a pointer, does'nt With make is faster by
removing a few levels of indirection?

Rgds,
Anand M
http://www.dotnetindia.com

"Chris, Master of All Things Insignifican" wrote:
I have come to greatly respect both Herfried & Cor's reponses and since the
two conflicted, I wanted to get some clarification.

My orginal post:
Herfried, maybe your example here can get you to answer a question I've
wondered about for a while.

With Me.Label1
.Text = ...
.Refresh()
End With

The idea behind the With clause is it allows for faster execution since
the "Me" ojbect doesn't have to be resolved 2 times in your example. But
you could rewrite your sample w/o the Me

With Label1
.Text = ...
.Refresh()
End With

In this case there wouldn't be any inhancement since you are not actually
eliminating the dot. Am I correct in my thinking?

Herfried's response
The 'Me.' is resolved even if it's not explicitly written. In this case I
used With type the code faster ;-).

Cor's Reposnse
The "Me" is only for the programmer, it does nothing at runtime.
The With clause creates an extra reference in a program. In this case it
will be slower than a program without a With clause, however think than
probably in parts of nanoseconds.
I hope this gives some ideas?


Nov 21 '05 #3
Thanks, you just proved that I was thinking correctly.

Chris

"Cor Ligthert" <no************@planet.nl> wrote in message
news:up**************@TK2MSFTNGP12.phx.gbl...
Chris,

Here the IL code from this program (I had it already ready when Herfried
would react however he did not) ;-)

Public Sub test()
With Me.label1
.Text = "Me"
.Refresh()
End With
With label1
.Text = "without Me"
.Refresh()
End With
label1.Text = "without With"
label1.Refresh()

End Sub
\\
IL_0000: ldarg.0
IL_0001: ldfld class
[System.Windows.Forms]System.Windows.Forms.Label Testje.Class1::label1
IL_0006: stloc.1
IL_0007: ldloc.1
IL_0008: ldstr "Me"
IL_000d: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::set_Text(string)
IL_0012: ldloc.1
IL_0013: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::Refresh()
IL_0018: ldnull
IL_0019: stloc.1
IL_001a: ldarg.0
IL_001b: ldfld class
[System.Windows.Forms]System.Windows.Forms.Label Testje.Class1::label1
IL_0020: stloc.0
IL_0021: ldloc.0
IL_0022: ldstr "without Me"
IL_0027: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::set_Text(string)
IL_002c: ldloc.0
IL_002d: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::Refresh()
IL_0032: ldnull
IL_0033: stloc.0
IL_0034: ldarg.0
IL_0035: ldfld class
[System.Windows.Forms]System.Windows.Forms.Label Testje.Class1::label1
IL_003a: ldstr "without With"
IL_003f: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::set_Text(string)
IL_0044: ldarg.0
IL_0045: ldfld class
[System.Windows.Forms]System.Windows.Forms.Label Testje.Class1::label1
IL_004a: callvirt instance void
[System.Windows.Forms]System.Windows.Forms.Control::Refresh()
IL_004f: ret
///

Nov 21 '05 #4

In the particular example, the With is not providing a benefit because
the target variable is immediately available.

With Me.Label1
.Text = ...
.Refresh()
End With

Is the same as

Dim lbl as Label = Me.Label1
lbl.Text = ...
lbl.Refresh()

which mostly likely a detraction given the extra variable allocation
and assignment. However, if the With was more complex, such as

With Me.SomeObject.NestedObject.SubNestedObject.AndFurt her
.Something ...
.SomethignElse...
.AndThirdThing...
End With

Then it can provide a benefit as the long list of evaluations is not
performed many times.

Sam
On Thu, 9 Dec 2004 08:43:45 -0800, "Anand[MVP]"
<An******@discussions.microsoft.com> wrote:
But if you look at it another way, if you consider a access to a property as
multiple levels of indirection of a pointer, does'nt With make is faster by
removing a few levels of indirection?

Rgds,
Anand M
http://www.dotnetindia.com


Nov 21 '05 #5

"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote
in message news:e%****************@TK2MSFTNGP12.phx.gbl...
I have come to greatly respect both Herfried & Cor's reponses and since
the two conflicted, I wanted to get some clarification.

My orginal post:
Herfried, maybe your example here can get you to answer a question I've
wondered about for a while.

With Me.Label1
.Text = ...
.Refresh()
End With

The idea behind the With clause is it allows for faster execution since
the "Me" ojbect doesn't have to be resolved 2 times in your example. But
you could rewrite your sample w/o the Me

With Label1
.Text = ...
.Refresh()
End With

In this case there wouldn't be any inhancement since you are not actually
eliminating the dot. Am I correct in my thinking?

Herfried's response
The 'Me.' is resolved even if it's not explicitly written. In this case I
used With type the code faster ;-).

Cor's Reposnse
The "Me" is only for the programmer, it does nothing at runtime.
The With clause creates an extra reference in a program. In this case it
will be slower than a program without a With clause, however think than
probably in parts of nanoseconds.
I hope this gives some ideas?


There's no disagreement. WITH is for programmer convenience only. It
introduces an additional local variable, and so it's certianly not faster.

Your notion that WITH helps with performance by reducting object resolutions
is obsolete. This was true when using VBScript and late-bound VB6, but not
in early-bound VB6 and not in VB.NET. These are compiled languages, and
objects references are fixed at compile-time.

BTW WITH still can reduce the number of reflection calls in late-bound
VB.NET, but you shouldn't be using late-bound VB.NET much, so it doesn't
count.

David
Nov 21 '05 #6
Chris,
They are both correct, its really a matter of perspective. Is the class half
full or is it really half empty?

If you leave Me off it is implicitly included.

However Me itself does not generate any code per se, Me is used by the
compiler to resolve identifiers. If you include Me the identifier is
resolved to the current object (ignoring local variables & parameters), if
you exclude Me the compiler resolves the identifier to the current scope,
which include locals variables & parameters. By current object I mean the
current class & any base classes.

The IL to access members of the current object is going to be the same
whether Me was included or not (which is what Cor showed).

IMHO: What matters more is the use of Me (implicitly or explicitly) verses
MyBase verses MyClass. As each has a specific context that the compiler uses
to search for members...
The With clause creates an extra reference in a program. In this case it
will be slower than a program without a With clause, however think than
probably in parts of nanoseconds. Are you quoting Cor correctly? With will normally increases not decreases
speed. Yes it creates a temporary variable, but that shouldn't really
matter.

A better example might be (within Form1)

Dim dialog As New Form2
With dialog.Label1
.Text = ...
.Refresh()
End With

Here dialog.Label1 is resolved once, then that temporary reference is used
to call .Text & .Refresh. Where as

dialog.Label1.Text = ...
dialog.Label1.Refresh()

Requires dialog.Label1 to be resolved twice, if you have 10 or more
statements inside the With & the with is in a loop, this can start adding up
quickly...

Hope this helps
Jay

"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote
in message news:e%****************@TK2MSFTNGP12.phx.gbl...I have come to greatly respect both Herfried & Cor's reponses and since
the two conflicted, I wanted to get some clarification.

My orginal post:
Herfried, maybe your example here can get you to answer a question I've
wondered about for a while.

With Me.Label1
.Text = ...
.Refresh()
End With

The idea behind the With clause is it allows for faster execution since
the "Me" ojbect doesn't have to be resolved 2 times in your example. But
you could rewrite your sample w/o the Me

With Label1
.Text = ...
.Refresh()
End With

In this case there wouldn't be any inhancement since you are not actually
eliminating the dot. Am I correct in my thinking?

Herfried's response
The 'Me.' is resolved even if it's not explicitly written. In this case I
used With type the code faster ;-).

Cor's Reposnse
The "Me" is only for the programmer, it does nothing at runtime.
The With clause creates an extra reference in a program. In this case it
will be slower than a program without a With clause, however think than
probably in parts of nanoseconds.
I hope this gives some ideas?

Nov 21 '05 #7
Samuel,

However it is the same as
dim mypointerwith as object =
Me.SomeObject.NestedObject.SubNestedObject.AndFurt her
mypointerwith.something
mypointerwiht.somethingelse
mypointerwith.andthirdthing

Not using a property is as well faster than using it, however that cannot be
a reason to avoid it.

That I say because what is saved is less than will ever be gained because
of the way most programs are used.

When those things become really important than you would start thinking in
not using C# or DotNet in my opinion. This is about parts of nanoseconds.

For me is readability more important, and than it becomes maybe a matter of
taste.
I don't like the "with" you see them mostly used by VB classic diehards.

Just my thought,

Cor
Nov 21 '05 #8
Jay,
The With clause creates an extra reference in a program. In this case it
will be slower than a program without a With clause, however think than
probably in parts of nanoseconds.
Are you quoting Cor correctly? With will normally increases not decreases
speed. Yes it creates a temporary variable, but that shouldn't really
matter.


Yes Chris is, look at "In this case", see for the rest as Samuel wrote and
my reply on that.

Cor
Nov 21 '05 #9
David,
Your notion that WITH helps with performance by reducting object
resolutions is obsolete.
Which is largely a myth!

It would be interesting to look at the IL for Samuel's suggestion:

Class base
Public class1 As class1
End Class

Class class1
Public class2 As class2
End Class

Class class2
Public class3 As class3
End Class

Class class3
Public class4 As class4
End Class

Class class4
Public class5 As class5
End Class

Class class5
Public value1 As Integer
Public value2 As Integer
Public value3 As Integer
End Class

Public Sub TestWith()
Dim a As base
With a.class1.class2.class3.class4.class5
.value1 = 1
.value2 = 2
.value3 = 3
End With
End Sub

Public Sub TestWithout()
Dim a As base
a.class1.class2.class3.class4.class5.value1 = 1
a.class1.class2.class3.class4.class5.value2 = 2
a.class1.class2.class3.class4.class5.value3 = 3
End Sub

Now check out the IL for the above two methods (release build under VS.NET
2003)

..method public instance void TestWith() cil managed
{
// Code size 51 (0x33)
.maxstack 2
.locals init (class XSLT.Sample.MainForm/base V_0,
class XSLT.Sample.MainForm/class5 V_1)
IL_0000: ldloc.0
IL_0001: ldfld class XSLT.Sample.MainForm/class1
XSLT.Sample.MainForm/base::class1
IL_0006: ldfld class XSLT.Sample.MainForm/class2
XSLT.Sample.MainForm/class1::class2
IL_000b: ldfld class XSLT.Sample.MainForm/class3
XSLT.Sample.MainForm/class2::class3
IL_0010: ldfld class XSLT.Sample.MainForm/class4
XSLT.Sample.MainForm/class3::class4
IL_0015: ldfld class XSLT.Sample.MainForm/class5
XSLT.Sample.MainForm/class4::class5
IL_001a: stloc.1
IL_001b: ldloc.1
IL_001c: ldc.i4.1
IL_001d: stfld int32 XSLT.Sample.MainForm/class5::value1
IL_0022: ldloc.1
IL_0023: ldc.i4.2
IL_0024: stfld int32 XSLT.Sample.MainForm/class5::value2
IL_0029: ldloc.1
IL_002a: ldc.i4.3
IL_002b: stfld int32 XSLT.Sample.MainForm/class5::value3
IL_0030: ldnull
IL_0031: stloc.1
IL_0032: ret
} // end of method MainForm::TestWith

..method public instance void TestWithout() cil managed
{
// Code size 97 (0x61)
.maxstack 2
.locals init (class XSLT.Sample.MainForm/base V_0)
IL_0000: ldloc.0
IL_0001: ldfld class XSLT.Sample.MainForm/class1
XSLT.Sample.MainForm/base::class1
IL_0006: ldfld class XSLT.Sample.MainForm/class2
XSLT.Sample.MainForm/class1::class2
IL_000b: ldfld class XSLT.Sample.MainForm/class3
XSLT.Sample.MainForm/class2::class3
IL_0010: ldfld class XSLT.Sample.MainForm/class4
XSLT.Sample.MainForm/class3::class4
IL_0015: ldfld class XSLT.Sample.MainForm/class5
XSLT.Sample.MainForm/class4::class5
IL_001a: ldc.i4.1
IL_001b: stfld int32 XSLT.Sample.MainForm/class5::value1
IL_0020: ldloc.0
IL_0021: ldfld class XSLT.Sample.MainForm/class1
XSLT.Sample.MainForm/base::class1
IL_0026: ldfld class XSLT.Sample.MainForm/class2
XSLT.Sample.MainForm/class1::class2
IL_002b: ldfld class XSLT.Sample.MainForm/class3
XSLT.Sample.MainForm/class2::class3
IL_0030: ldfld class XSLT.Sample.MainForm/class4
XSLT.Sample.MainForm/class3::class4
IL_0035: ldfld class XSLT.Sample.MainForm/class5
XSLT.Sample.MainForm/class4::class5
IL_003a: ldc.i4.2
IL_003b: stfld int32 XSLT.Sample.MainForm/class5::value2
IL_0040: ldloc.0
IL_0041: ldfld class XSLT.Sample.MainForm/class1
XSLT.Sample.MainForm/base::class1
IL_0046: ldfld class XSLT.Sample.MainForm/class2
XSLT.Sample.MainForm/class1::class2
IL_004b: ldfld class XSLT.Sample.MainForm/class3
XSLT.Sample.MainForm/class2::class3
IL_0050: ldfld class XSLT.Sample.MainForm/class4
XSLT.Sample.MainForm/class3::class4
IL_0055: ldfld class XSLT.Sample.MainForm/class5
XSLT.Sample.MainForm/class4::class5
IL_005a: ldc.i4.3
IL_005b: stfld int32 XSLT.Sample.MainForm/class5::value3
IL_0060: ret
} // end of method MainForm::TestWithout

Notice that TestWith resolves a.class1.class2.class3.class4.class5 once as
you stated, while TestWithout resolves it 3 times. Also notice that
TestWithout is almost twice as large (code size 97 verses 51)

I have not, but it might be interesting to look at what the JIT compiler
generates for the above. It might also be interesting to profile (time)
TestWith & TestWithout...

Granted I rarely use "a.class1.class2.class3.class4.class5" in real code and
most of my With statements wind up being methods on the target object, its
still nice to see what is really going on.

Hope this helps
Jay

"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:Ob**************@tk2msftngp13.phx.gbl...
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com>
wrote in message news:e%****************@TK2MSFTNGP12.phx.gbl...
I have come to greatly respect both Herfried & Cor's reponses and since
the two conflicted, I wanted to get some clarification.

My orginal post:
Herfried, maybe your example here can get you to answer a question I've
wondered about for a while.

With Me.Label1
.Text = ...
.Refresh()
End With

The idea behind the With clause is it allows for faster execution since
the "Me" ojbect doesn't have to be resolved 2 times in your example. But
you could rewrite your sample w/o the Me

With Label1
.Text = ...
.Refresh()
End With

In this case there wouldn't be any inhancement since you are not actually
eliminating the dot. Am I correct in my thinking?

Herfried's response
The 'Me.' is resolved even if it's not explicitly written. In this case
I
used With type the code faster ;-).

Cor's Reposnse
The "Me" is only for the programmer, it does nothing at runtime.
The With clause creates an extra reference in a program. In this case it
will be slower than a program without a With clause, however think than
probably in parts of nanoseconds.
I hope this gives some ideas?


There's no disagreement. WITH is for programmer convenience only. It
introduces an additional local variable, and so it's certianly not faster.

Your notion that WITH helps with performance by reducting object
resolutions is obsolete. This was true when using VBScript and late-bound
VB6, but not in early-bound VB6 and not in VB.NET. These are compiled
languages, and objects references are fixed at compile-time.

BTW WITH still can reduce the number of reflection calls in late-bound
VB.NET, but you shouldn't be using late-bound VB.NET much, so it doesn't
count.

David

Nov 21 '05 #10
Cor,
See my response to David.

Just remember:
- Poorly used With will probably hurt performance.
- Properly used With with "poor code" will probably help performance.
- Good OO code doesn't really need With

I agree readability is a primary factor. However! I really don't see how
With is any more or any less readably then a local variable. Ergo, for me,
With & readability is a non issue.

Good OO suggests that
"Me.SomeObject.NestedObject.SubNestedObject.AndFur ther" is knowing far too
much about far too many other objects. That your code is TOO coupled to your
grand children & great grand children.

In the "Me.SomeObject.NestedObject.SubNestedObject.AndFur ther" sample I
would probably use Martin Fowler's "Hide Delegate" refactoring.
http://www.refactoring.com/catalog/hideDelegate.html To encapsulate the
logic...

However its still good to try to learn what With really does, rather then
surmising

Consider the results of the following (continuing my earlier sample):

Declare Function QueryPerformanceCounter Lib "Kernel32" (ByRef X As
Long) As Short
Declare Function QueryPerformanceFrequency Lib "Kernel32" (ByRef X As
Long) As Short

Public Shared Sub Main()
Const MaxIterations As Integer = 100000000
Dim a As New Base
Dim start, finish As Long
Dim frequency As Long
QueryPerformanceFrequency(frequency)

For test As Integer = 1 To 5
Debug.WriteLine(test, "Test")
Debug.Indent()
QueryPerformanceCounter(start)
For count As Integer = 1 To MaxIterations
TestWith(a)
Next
QueryPerformanceCounter(finish)
Debug.WriteLine(TimeSpan.FromSeconds((finish - start) /
frequency), "with")

QueryPerformanceCounter(start)
For count As Integer = 1 To MaxIterations
TestWithout(a)
Next
QueryPerformanceCounter(finish)
Debug.WriteLine(TimeSpan.FromSeconds((finish - start) /
frequency), "with out")

QueryPerformanceCounter(start)
For count As Integer = 1 To MaxIterations
TestLocal(a)
Next
QueryPerformanceCounter(finish)
Debug.WriteLine(TimeSpan.FromSeconds((finish - start) /
frequency), "local")

Debug.Unindent()
Debug.WriteLine(Nothing)
Next
End Sub

Public Shared Sub TestLocal(ByVal a As Base)
Dim c5 As Class5 = a.class1.class2.class3.class4.class5
c5.value1 = 1
c5.value2 = 2
c5.value3 = 3
End Sub

Which is interesting.

TestLocal is slightly faster then TestWith (I would expected them to be
identical). Lets double check the IL: the With clears the temporary
variable, which as we know isn't normally necessary. If I add "c5 = Nothing"
to the end of TestLocal then they run "identical"...

While TestWithout is not quite twice as slow as TestWith, which is what I
would expect & I was attempting to state earlier, which clearly suggests
that With can improve performance!

Of course the above test was designed to prove the point that With will help
performance with some code. In the original questions case I think its
largely a moot point, there With is "purely" personal preference.

Naturally it comes down to profiling, the 80/20 rule, and personal
preference if With is needed or not...

Hope this helps
Jay

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uZ**************@TK2MSFTNGP14.phx.gbl...
Jay,
The With clause creates an extra reference in a program. In this case it
will be slower than a program without a With clause, however think than
probably in parts of nanoseconds.

Are you quoting Cor correctly? With will normally increases not decreases
speed. Yes it creates a temporary variable, but that shouldn't really
matter.


Yes Chris is, look at "In this case", see for the rest as Samuel wrote and
my reply on that.

Cor

Nov 21 '05 #11

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:ue**************@TK2MSFTNGP10.phx.gbl...
David,
Your notion that WITH helps with performance by reducting object
resolutions is obsolete.


Which is largely a myth!


WITH can still reduce the number of property access and method access calls
somewhat. But in the "bad old days" you payed a performance penalty for
each use of the "." and operators "!", especially "!" which was used a lot.
Without variable typing each line had to interrogate the type of the object
and find the target method. Since this happened on _every_ method
invocation and the language was interpreted to begin with, using WITH was an
important performance item.

with obj
.Method1()
.Method2()
end with

Was really better than

obj.Method1()
obj.Method2()

With VB.NET this is no longer the case, and most realistic VB code can't be
substantially improved by WITH.

David
Nov 21 '05 #12
David,
With VB.NET this is no longer the case, and most realistic VB code can't
be substantially improved by WITH. Which I hope you will agree is what I stated in my reply to Cor.

I also hope you will agree, even under VB5 & VB6 in your simply example
there would be no real performance benefit. As they compiled the code. Hell,
I hope you will agree, that your simply example wouldn't even benefit
VBScript as obj.Method1 & with obj .Method1 are synonymous.

The benefit (in VB6, VBScript, & VB.NET) is when you use something like what
Samuel showed. Which I hope you agree I demonstrated in my other responses
is still true in .NET. Hence my "its largely a myth" statement!

Just a thought
Jay
"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:%2****************@TK2MSFTNGP09.phx.gbl...
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:ue**************@TK2MSFTNGP10.phx.gbl...
David,
Your notion that WITH helps with performance by reducting object
resolutions is obsolete.


Which is largely a myth!


WITH can still reduce the number of property access and method access
calls somewhat. But in the "bad old days" you payed a performance penalty
for each use of the "." and operators "!", especially "!" which was used a
lot. Without variable typing each line had to interrogate the type of the
object and find the target method. Since this happened on _every_ method
invocation and the language was interpreted to begin with, using WITH was
an important performance item.

with obj
.Method1()
.Method2()
end with

Was really better than

obj.Method1()
obj.Method2()

With VB.NET this is no longer the case, and most realistic VB code can't
be substantially improved by WITH.

David

Nov 21 '05 #13
"Cor Ligthert" <no************@planet.nl> schrieb:
Here the IL code from this program (I had it already ready when Herfried
would react however he did not) ;-)


There was no reason for me to react because the things we said were not in
conflict.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #14
Cor,

"Cor Ligthert" <no************@planet.nl> schrieb:
For me is readability more important, and than it becomes maybe a matter
of taste.
ACK.
I don't like the "with" you see them mostly used by VB classic diehards.


I like 'With' because it makes code more readable and better maintainable.
Why should I waste time thinking about a variable name I don't need. Why
should I have to update many lines of code when the name of the variable
changes? Why should I type more? Using a variable IMO doesn't add much
benefit to the code. It just adds one worthless variable.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #15

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote
Naturally it comes down to profiling, the 80/20 rule, and personal
preference if With is needed or not...


You've mentioned this before, (in the link you posted to the AndAlso thread)
and I don't see this used as often as programming by rote memory. Here
you've shown that With will be perfomant when nested references are required,
and I would suggest that the same would be true in other cases where nested
references are required. So, there is no need to profile later usage, you know
using With will add performance in a certain situation, which should lead a
developer to 'automatically' select to use With, in those situations.

After doing enough profiling on different applications, a person is going to
learn which syntax options are more perfomant, and should natually gravitate
to using the more perfomant versions. I simply wanted to suggest that this
'coding by rote' will probably be used more often than the 80/20 rule which
would require profiling each application to find the bottlenecks. Of course
preference still plays a part, when performance gains are negligable, but on
the whole, we all learn from past experiences which should be used to help
formulate our future responses. I don't have a name for this, other than
experience, but again, I am thinking it would play a larger part in development,
than the 80/20 rule....

LFS
Nov 21 '05 #16
"Samuel R. Neff" <bl****@newsgroup.nospam> schrieb:
In the particular example, the With is not providing a benefit because
the target variable is immediately available.

With Me.Label1
.Text = ...
.Refresh()
End With

Is the same as

Dim lbl as Label = Me.Label1
lbl.Text = ...
lbl.Refresh()


ACK. When writing the code the OP quoted I didn't think about runtime
benefits. I could have written the latter solution too, but I decided to
use 'With' because it IMO makes the code more readable. No annoying 'lbl.'
in front of the property names helps me to clearly see the property names.

To make a conclusion: 'With' has two benefits when used properly: On the
one hand, it improves the performance of the application for access of
nested objects or objects that would have to be recalculated otherwise, on
the other hand, it improves readability and maintainability of code in some
other cases. Nevertheless, there are cases, where 'With' doesn't make
sense, for example, more than one nesting level can lead to extra code when
you need to access the object referenced by a surrounding 'With' block.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #17
Cor & David,
Interesting, if you compile my "benchmark" in the release build & run it
outside the IDE (such as from a command prompt). The times are all nearly
identical. Which IMHO makes With purely personal prefence (no hurt & no
help, use it if it helps you read the code).

Try the following in a Console application, where WithTests is the startup
module: Run it both in Debug & Release builds, run it both from the IDE &
from a command line...

Option Strict On
Option Explicit On

Public Class WithTests

Class Base
Public ReadOnly class1 As New class1
End Class

Class Class1
Public ReadOnly class2 As New class2
End Class

Class Class2
Public ReadOnly class3 As New class3
End Class

Class Class3
Public ReadOnly class4 As New class4
End Class

Class Class4
Public ReadOnly class5 As New class5
End Class

Class Class5
Public value1 As Integer
Public value2 As Integer
Public value3 As Integer
End Class

Declare Function QueryPerformanceCounter Lib "Kernel32" (ByRef X As
Long) As Short
Declare Function QueryPerformanceFrequency Lib "Kernel32" (ByRef X As
Long) As Short

Private Shared Sub WriteTotal(ByVal start As Long, ByVal finish As Long,
ByVal frequency As Long, ByVal category As String)
Const format As String = " {0}: elapsed={1}, seconds={2}"
Console.WriteLine(format, category, (finish - start),
TimeSpan.FromSeconds((finish - start) / frequency))
End Sub

Public Shared Sub Main()
Const format As String = "Test: {0}"
Const MaxIterations As Integer = 100000000
Dim a As New Base
Dim start, finish As Long
Dim frequency As Long
QueryPerformanceFrequency(frequency)

For test As Integer = 1 To 5
Console.WriteLine(format, test)
QueryPerformanceCounter(start)
For count As Integer = 1 To MaxIterations
TestWith(a)
Next
QueryPerformanceCounter(finish)
WriteTotal(start, finish, frequency, "with")

QueryPerformanceCounter(start)
For count As Integer = 1 To MaxIterations
TestWithout(a)
Next
QueryPerformanceCounter(finish)
WriteTotal(start, finish, frequency, "with out")

QueryPerformanceCounter(start)
For count As Integer = 1 To MaxIterations
TestLocal(a)
Next
QueryPerformanceCounter(finish)
WriteTotal(start, finish, frequency, "local")

Console.WriteLine()
Next
Return

Application.EnableVisualStyles()
Application.DoEvents()
Application.Run(New MainForm)
End Sub

Public Shared Sub TestWith(ByVal a As Base)
With a.class1.class2.class3.class4.class5
.value1 = 1
.value2 = 2
.value3 = 3
End With
End Sub

Public Shared Sub TestWithout(ByVal a As Base)
a.class1.class2.class3.class4.class5.value1 = 1
a.class1.class2.class3.class4.class5.value2 = 2
a.class1.class2.class3.class4.class5.value3 = 3
End Sub

Public Shared Sub TestLocal(ByVal a As Base)
Dim c5 As Class5 = a.class1.class2.class3.class4.class5
c5.value1 = 1
c5.value2 = 2
c5.value3 = 3
c5 = Nothing
End Sub

End Class

Results on my computer:
Test: 1
with: elapsed=8950281, seconds=00:00:02.5000000
with out: elapsed=8595814, seconds=00:00:02.4010000
local: elapsed=8918192, seconds=00:00:02.4910000

Test: 2
with: elapsed=8613901, seconds=00:00:02.4060000
with out: elapsed=8615269, seconds=00:00:02.4070000
local: elapsed=8781567, seconds=00:00:02.4530000

Test: 3
with: elapsed=9588239, seconds=00:00:02.6790000
with out: elapsed=11203925, seconds=00:00:03.1300000
local: elapsed=10471614, seconds=00:00:02.9250000

Test: 4
with: elapsed=8614997, seconds=00:00:02.4070000
with out: elapsed=8615433, seconds=00:00:02.4070000
local: elapsed=8778982, seconds=00:00:02.4530000

Test: 5
with: elapsed=8675226, seconds=00:00:02.4240000
with out: elapsed=8610307, seconds=00:00:02.4050000
local: elapsed=8558526, seconds=00:00:02.3910000

Hope this helps
Jay
"Cor Ligthert" <no************@planet.nl> wrote in message
news:uZ**************@TK2MSFTNGP14.phx.gbl...
Jay,
The With clause creates an extra reference in a program. In this case it
will be slower than a program without a With clause, however think than
probably in parts of nanoseconds.

Are you quoting Cor correctly? With will normally increases not decreases
speed. Yes it creates a temporary variable, but that shouldn't really
matter.


Yes Chris is, look at "In this case", see for the rest as Samuel wrote and
my reply on that.

Cor

Nov 21 '05 #18
Larry,
I agree!
simply wanted to suggest that this
'coding by rote' will probably be used more often than the 80/20 rule
which However! far too many developers practice "coding by rut" ("coding by
rote's" close cousin) in which a developer picks up a habit and is unable to
change or unaware change is possible.

rut: a usual way of doing something form which one is not easily stirred.

By pointing out the 80/20 rule I am attempting to remind people that "x
works 80% of the time" that you also have to be aware that "y is preferred
20% of time".
After doing enough profiling on different applications, a person is going
to
learn which syntax options are more perfomant I take it you worry more about performant code then "correct" code? By
"correct" code I mean a sold OO design which allows easy of maintainability
& readibility among other things...

I value "correct" code. Of course "correct" code includes some "performant"
features (deciding if StringBuilder or String.Concat is better in this
routine) however that is not the driving force... OO design,
maintainability, readability are IMHO more important driving forces... I
also realize due to the 80/20 rule that I may pick a StringBuilder by
"rote", but find out later that String.Concat would have been later by
profiling.

Hope this helps
Jay
"Larry Serflaten" <se*******@usinternet.com> wrote in message
news:eZ*************@TK2MSFTNGP11.phx.gbl...
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote
Naturally it comes down to profiling, the 80/20 rule, and personal
preference if With is needed or not...


You've mentioned this before, (in the link you posted to the AndAlso
thread)
and I don't see this used as often as programming by rote memory. Here
you've shown that With will be perfomant when nested references are
required,
and I would suggest that the same would be true in other cases where
nested
references are required. So, there is no need to profile later usage, you
know
using With will add performance in a certain situation, which should lead
a
developer to 'automatically' select to use With, in those situations.

After doing enough profiling on different applications, a person is going
to
learn which syntax options are more perfomant, and should natually
gravitate
to using the more perfomant versions. I simply wanted to suggest that
this
'coding by rote' will probably be used more often than the 80/20 rule
which
would require profiling each application to find the bottlenecks. Of
course
preference still plays a part, when performance gains are negligable, but
on
the whole, we all learn from past experiences which should be used to help
formulate our future responses. I don't have a name for this, other than
experience, but again, I am thinking it would play a larger part in
development,
than the 80/20 rule....

LFS

Nov 21 '05 #19
On Thu, 9 Dec 2004 18:20:25 +0100, "Cor Ligthert"
<no************@planet.nl> wrote:
Samuel,

However it is the same as
dim mypointerwith as object =
Me.SomeObject.NestedObject.SubNestedObject.AndFur ther
mypointerwith.something
mypointerwiht.somethingelse
mypointerwith.andthirdthing


yeah, that's exactly what I said... C# doesn't have a "With"
equivalent so if you decompile VB.NET With code to C# you'll see a new
variable created and assigned just like in the above code. There is
no difference between "With" and a local variable. There is a
difference betwen "With" and repeated references to deeply nested
objects (and nesting beyond two levels is unusual in real programs
anyways).

Sam
Nov 21 '05 #20

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote
Cor & David,
Interesting, if you compile my "benchmark" in the release build & run it
outside the IDE (such as from a command prompt). The times are all nearly
identical. Which IMHO makes With purely personal prefence (no hurt & no
help, use it if it helps you read the code).


Also, if you USE that 'do nothing' code.

A major question I would have is:

How much optimization is being done by the JIT compiler, in that sort of
'minimal' code? Did the JIT compiler resolve the references (providing inline
code perhaps), or are you actually resolving them with your code?
(Yes, the JIT compiler does its own optimizations...)

???
LFS
Nov 21 '05 #21

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote
I take it you worry more about performant code then "correct" code?
By "correct" code I mean a sold OO design which allows easy of maintainability
& readibility among other things...
When performance differences are negligible, I tend to be a minimalist. I want
to use only the code necessary to do the job.
OO design,
maintainability, readability are IMHO more important driving forces...


I'd order them differently; Readability, conciseness, and then OO design.

If the code is easily read, it will 'generally' also be easy to maintain, and,
OOA is not as important to me as keeping code size down to more managable
sizes. I really liked 'component based' programming (AKA: COM) and to
the effect that objects also include encapsulation, I like those as well.

:-)
LFS
Nov 21 '05 #22
Larry,
A major question I would have is:

How much optimization is being done by the JIT compiler, in that sort of
'minimal' code? Isn't this a Moot or Rhetorical question? If all three perform the same in
Release builds, and differently in Debug, would that not suggest the JIT is
doing some serious optimization?
As you know Debug builds & running under the IDE disable most if not all JIT
optimizations.

(Yes, the JIT compiler does its own optimizations...) I hope you are not impling I do not know that, as that is why I specifically
stated, run the release build outside the IDE!

Hope this helps
Jay
"Larry Serflaten" <se*******@usinternet.com> wrote in message
news:e5**************@tk2msftngp13.phx.gbl...
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote
Cor & David,
Interesting, if you compile my "benchmark" in the release build & run it
outside the IDE (such as from a command prompt). The times are all nearly
identical. Which IMHO makes With purely personal prefence (no hurt & no
help, use it if it helps you read the code).


Also, if you USE that 'do nothing' code.

A major question I would have is:

How much optimization is being done by the JIT compiler, in that sort of
'minimal' code? Did the JIT compiler resolve the references (providing
inline
code perhaps), or are you actually resolving them with your code?
(Yes, the JIT compiler does its own optimizations...)

???
LFS

Nov 21 '05 #23

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:O2**************@TK2MSFTNGP15.phx.gbl...
David,
With VB.NET this is no longer the case, and most realistic VB code can't
be substantially improved by WITH.

Which I hope you will agree is what I stated in my reply to Cor.

I also hope you will agree, even under VB5 & VB6 in your simply example
there would be no real performance benefit.


Absolutely. VBScript performance used to really matter because of Microsoft
Access and then because of ASP. Only then was WITH even on the performance
radar.

And I believe that in VBScript
with obj
.foo
.foo
end with

was faster than
obj.foo
obj.foo

because the runtime type of obj only had to be discovered once.

David
Nov 21 '05 #24

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote
How much optimization is being done by the JIT compiler, in that sort of
'minimal' code?
Isn't this a Moot or Rhetorical question? If all three perform the same in
Release builds, and differently in Debug, would that not suggest the JIT is
doing some serious optimization?


Quite so, which is why I wondered how you could conclude that With usage was
purely personal preference related, opposed to deducing that perhaps, the code
used was not diverse enough to show where With is a benefit:
The times are all nearly identical. Which IMHO makes With purely personal
prefence (no hurt & no help, use it if it helps you read the code).
Perhaps using With on an external object, where JIT optimizations would not
apply, might be a better example for profiling?

(Yes, the JIT compiler does its own optimizations...)

I hope you are not impling I do not know that


No, that was a parenthetical inclusion for everyone else who may be
reading the thread....

LFS
Nov 21 '05 #25
David,
because the runtime type of obj only had to be discovered once. I would hope it does, Its been too long since I used VBScript...
VBScript performance used to really matter because of Microsoft Access and
then because of ASP. Microsoft Access uses VBA not VBScript. Access started out with Access Basic

ASP & Outlook use VBScript.

Thanks for the info
Jay
"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:%2****************@TK2MSFTNGP15.phx.gbl...
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:O2**************@TK2MSFTNGP15.phx.gbl...
David,
With VB.NET this is no longer the case, and most realistic VB code can't
be substantially improved by WITH.

Which I hope you will agree is what I stated in my reply to Cor.

I also hope you will agree, even under VB5 & VB6 in your simply example
there would be no real performance benefit.


Absolutely. VBScript performance used to really matter because of
Microsoft Access and then because of ASP. Only then was WITH even on the
performance radar.

And I believe that in VBScript
with obj
.foo
.foo
end with

was faster than
obj.foo
obj.foo

because the runtime type of obj only had to be discovered once.

David

Nov 21 '05 #26
Larry,
Perhaps using With on an external object, where JIT optimizations would
not
apply, might be a better example for profiling? I'm sorry I believe you missed the reason for the sample in an earlier post
of mine:

<quote>
Of course the above test was designed to prove the point that With will help
performance with some code. In the original questions case I think its
largely a moot point, there With is "purely" personal preference.
</quote>

The sample I did intentionally shows that using With is a personal
preference, it was to disprove the statement.

<quote>
Your notion that WITH helps with performance by reducting object
resolutions is obsolete.
</quote>

As we all know a number of benchmarks are generally designed to prove a
point. Personally you need to profile actual specific code (not create a
"better example") to decide if the code fits or does not fit a routine.
(hint the 80/20 rule).

Hope this helps
Jay

"Larry Serflaten" <se*******@usinternet.com> wrote in message
news:ur****************@TK2MSFTNGP11.phx.gbl...
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote
> How much optimization is being done by the JIT compiler, in that sort
> of
> 'minimal' code?
Isn't this a Moot or Rhetorical question? If all three perform the same
in
Release builds, and differently in Debug, would that not suggest the JIT
is
doing some serious optimization?


Quite so, which is why I wondered how you could conclude that With usage
was
purely personal preference related, opposed to deducing that perhaps, the
code
used was not diverse enough to show where With is a benefit:
> The times are all nearly identical. Which IMHO makes With purely
> personal
> prefence (no hurt & no help, use it if it helps you read the code).
Perhaps using With on an external object, where JIT optimizations would
not
apply, might be a better example for profiling?

> (Yes, the JIT compiler does its own optimizations...)

I hope you are not impling I do not know that


No, that was a parenthetical inclusion for everyone else who may be
reading the thread....

LFS

Nov 21 '05 #27
Jay,

I tested it, outside the IDE and inside. Outside : inside the IDE is about
1:1,5 for all except the part without "with" which is inside the IDE 2 times
slower than the other ones.

After that you have explained what is this code beneath in your code, than I
thank you for supplying this test to us, now we can point next time to that
test when the question comes again.
Return

Application.EnableVisualStyles()
Application.DoEvents()
Application.Run(New MainForm)
Cor
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> Cor & David,
Interesting, if you compile my "benchmark" in the release build & run it
outside the IDE (such as from a command prompt). The times are all nearly
identical. Which IMHO makes With purely personal prefence (no hurt & no
help, use it if it helps you read the code).

Try the following in a Console application, where WithTests is the startup
module: Run it both in Debug & Release builds, run it both from the IDE &
from a command line...

Option Strict On
Option Explicit On

Public Class WithTests

Class Base
Public ReadOnly class1 As New class1
End Class

Class Class1
Public ReadOnly class2 As New class2
End Class

Class Class2
Public ReadOnly class3 As New class3
End Class

Class Class3
Public ReadOnly class4 As New class4
End Class

Class Class4
Public ReadOnly class5 As New class5
End Class

Class Class5
Public value1 As Integer
Public value2 As Integer
Public value3 As Integer
End Class

Declare Function QueryPerformanceCounter Lib "Kernel32" (ByRef X As
Long) As Short
Declare Function QueryPerformanceFrequency Lib "Kernel32" (ByRef X As
Long) As Short

Private Shared Sub WriteTotal(ByVal start As Long, ByVal finish As
Long, ByVal frequency As Long, ByVal category As String)
Const format As String = " {0}: elapsed={1}, seconds={2}"
Console.WriteLine(format, category, (finish - start),
TimeSpan.FromSeconds((finish - start) / frequency))
End Sub

Public Shared Sub Main()
Const format As String = "Test: {0}"
Const MaxIterations As Integer = 100000000
Dim a As New Base
Dim start, finish As Long
Dim frequency As Long
QueryPerformanceFrequency(frequency)

For test As Integer = 1 To 5
Console.WriteLine(format, test)
QueryPerformanceCounter(start)
For count As Integer = 1 To MaxIterations
TestWith(a)
Next
QueryPerformanceCounter(finish)
WriteTotal(start, finish, frequency, "with")

QueryPerformanceCounter(start)
For count As Integer = 1 To MaxIterations
TestWithout(a)
Next
QueryPerformanceCounter(finish)
WriteTotal(start, finish, frequency, "with out")

QueryPerformanceCounter(start)
For count As Integer = 1 To MaxIterations
TestLocal(a)
Next
QueryPerformanceCounter(finish)
WriteTotal(start, finish, frequency, "local")

Console.WriteLine()
Next
Return

Application.EnableVisualStyles()
Application.DoEvents()
Application.Run(New MainForm)
End Sub

Public Shared Sub TestWith(ByVal a As Base)
With a.class1.class2.class3.class4.class5
.value1 = 1
.value2 = 2
.value3 = 3
End With
End Sub

Public Shared Sub TestWithout(ByVal a As Base)
a.class1.class2.class3.class4.class5.value1 = 1
a.class1.class2.class3.class4.class5.value2 = 2
a.class1.class2.class3.class4.class5.value3 = 3
End Sub

Public Shared Sub TestLocal(ByVal a As Base)
Dim c5 As Class5 = a.class1.class2.class3.class4.class5
c5.value1 = 1
c5.value2 = 2
c5.value3 = 3
c5 = Nothing
End Sub

End Class

Results on my computer:
Test: 1
with: elapsed=8950281, seconds=00:00:02.5000000
with out: elapsed=8595814, seconds=00:00:02.4010000
local: elapsed=8918192, seconds=00:00:02.4910000

Test: 2
with: elapsed=8613901, seconds=00:00:02.4060000
with out: elapsed=8615269, seconds=00:00:02.4070000
local: elapsed=8781567, seconds=00:00:02.4530000

Test: 3
with: elapsed=9588239, seconds=00:00:02.6790000
with out: elapsed=11203925, seconds=00:00:03.1300000
local: elapsed=10471614, seconds=00:00:02.9250000

Test: 4
with: elapsed=8614997, seconds=00:00:02.4070000
with out: elapsed=8615433, seconds=00:00:02.4070000
local: elapsed=8778982, seconds=00:00:02.4530000

Test: 5
with: elapsed=8675226, seconds=00:00:02.4240000
with out: elapsed=8610307, seconds=00:00:02.4050000
local: elapsed=8558526, seconds=00:00:02.3910000

Hope this helps
Jay
"Cor Ligthert" <no************@planet.nl> wrote in message
news:uZ**************@TK2MSFTNGP14.phx.gbl...
Jay,
The With clause creates an extra reference in a program. In this case
it
will be slower than a program without a With clause, however think than
probably in parts of nanoseconds.

Are you quoting Cor correctly? With will normally increases not
decreases speed. Yes it creates a temporary variable, but that shouldn't
really matter.


Yes Chris is, look at "In this case", see for the rest as Samuel wrote
and my reply on that.

Cor


Nov 21 '05 #28

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
6
by: Steven An | last post by:
Howdy, I need to write an update query with multiple aggregate functions. Here is an example: UPDATE t SET t.a = ( select avg(f.q) from dbo.foo f where f.p = t.y ), t.b = ( select sum(f.q)...
3
by: Jerry | last post by:
Well, here is some weirdness. First, I noticed that I have 2 Set keywords (silly me). so I removed the 2nd "Set" but still got a syntax error. Then I removed the Where clause, and now it works...
20
by: Brian Tkatch | last post by:
An ORDER BY a simple-integer inside a FUNCTION, results in SQL0440N, unless the FUNCTION expects an INTEGER as its parameter. For example: DECLARE GLOBAL TEMPORARY TABLE A(A CHAR(1)) INSERT INTO...
26
by: GreatAlterEgo | last post by:
Hi, This is my query which is embedded in a COBOL program. EXEC SQL SELECT DATE, AGE, DURATION, AMT INTO :LDATE, :L.AGE, :L.DURATION, :L.AMT FROM TAB1 WHERE CODE = :KEY.CODE AND...
3
by: rcamarda | last post by:
I have a field that may be null which is valid, and I am finding something I didnt expect when working with nulls. SELECT NULL/4.0 will return NULL (which I expect), however, when I test it with a...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
3
by: rogynskyy | last post by:
Hi guys, I'm running MSDE 2000 A on Win XP I've got a database with several tables, all of the tables display data in query manager. I wrote this simple query: Select
5
by: Sascha.Moellering | last post by:
Hi, I receive the error code SQL0338N if I try to compile this statement (part of the statement): .... left outer join lateral (SELECT * FROM LIZSYSABA.VWZL0359TBS WHERE tbs_name = CASE WHEN...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.