Pete's Windows, Office, VB & SQL Blog

Problems I have solved (or not) and good ideas I've found

Posts Tagged ‘.net 2.0 sp1

A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 – An existing connection was forcibly closed by the remote host.)

leave a comment »

msdn seems to have a reasonable description of the problem here.  However my SQL Server log does not contain any entries for the time of the failure.

The last message in the latest SQL ErrorLog file is at 04:29:58.48

My application reports the connection status as open at 05:21:37.781

The failure occurs at 05:21:37.875 – less than 0.1 seconds later!

There are no messages in the eventlog in this time period.

Written by fisherpeter

2009 November 30 at 16:01

My.User.Name returns an empty string

leave a comment »

I’m not sure when or why this happened.  It MAY be related to this application being a console application.

The alternative is:

Console.WriteLine(“Windows ID:” & System.Security.Principal.WindowsIdentity.GetCurrent.Name)

from a post here:

http://bytes.com/topic/visual-basic-net/answers/585547-my-user-name-returning-empty-xp-pro-sp2

Written by fisherpeter

2009 August 14 at 14:07

‘Public Property Left() or Right() As Integer’ has no parameters and its return type cannot be indexed

with one comment

The message appears against x = Left(a,2) – all of them.

The problem goes away if I comment out the line:
Imports System.Collections.ObjectModel
but I need that in order to define a variable as
ReadOnlyCollection(Of String)

There are some sites that suggest the Left is deprecated as a function, but this does not appear to be the case. (http://msdn.microsoft.com/en-us/library/y050k1wb(VS.80).aspx)

Resolution

This appears to be a poor piece of decision making by the compiler.  Left can be qualified as strings.left, in which case the interpretation is explicit and correct.

e.g.

x = Strings.Left(a,2)

Written by fisherpeter

2009 August 7 at 10:47

Follow

Get every new post delivered to your Inbox.