Showing posts with label vb6. Show all posts
Showing posts with label vb6. Show all posts

Friday, February 24, 2012

Communication link failure

I have a VB6 application running on an SQLServer database. At first, the co
nnection to the database succeeds, a number of sql subsequent statements (bo
th select and update statements) succeed and then from some point on (after
about 80 sql statements), I
get the following error message : -2147467259 : [Microsoft][ODBD SQL
Server Driver]Communication link failure.
This happens on a number of P.C.'s, however not on all of them.
Thanks,
John DesmetThis sounds like it might share a few common features with a posting I made
here on March 5, under the heading:
Re: Occasional "Timeout expired" message - on SP that should take 1 second
What do you think? This syndrome sometimes also generates the
"Communication Link Failure" message.
- ITFred|||Thank you for your reply. At the end of the day (literally), we found out t
hat the Symantic Client Firewall is causing the problem. When it is turned
off, the problem no longer occurs. Now, we have to modify a number of firew
all settings.
Thanks,
John Desmet

Tuesday, February 14, 2012

Command.Parameters collection populated automatically

Hi,

We have a lot of VB6 code that uses ADO 2.7 and stored procs wih Sql 2005. I have noticed recently that if I use the follow code:

Dim con As New ADODB.Connection
con.ConnectionString = "driver={SQL Server};server=(local);database=test;uid=sa;pwd="
con.Open

Dim com As New ADODB.Command

com.ActiveConnection = con
com.CommandText = "usp_GetSetting"
com.CommandType = adCmdStoredProc

com.Parameters.Append com.CreateParameter(...)

It will fail. the reason being the after setting the CommantText and Type ADO then seems to automatically go away and populate the Parameters collection from the databases metadata according to the SP we are calling.

I have never seen this before, I thought the Refresh method had to be called before the parameters collection get populated.

Can anyone help me please?

Ok,

I think I know what is going on. Is just so happens that my latest debug code contained com.Parameters.Count before the first Parameters.Append statement. I think it is the act of counting the parameters that is causing it to go off and retrieve them all.

Sorry to be an idiot :(

Graham