Wednesday, March 21, 2012

Invalid Object Name

Hi,
My application uses VB6 and Sql-Server 2000.
I cant understand why the error
INVALID OBJECT NAME Run-time error '-2147217865 (80040e37)'
appears only sometimes and not always. For example, a select instruction is executed inside a loop without any problem 1 thousand times, then when I try to execute it 1 thousand times and one, it fails.


Have you got any suggestions?

Ive read a lot of posts on Internet Forums, without finding any solutions.

In the mail I attach, you can see that the application stops at 79%, after having executed many times the select instruction without any problem!

Thank you very much for your help!

Bye,

EmanuelaWhat attachment?

Just post the code here...but my guess is you're building dynamic sql|||Without seeing it I too am guessing dynamic SQL, but I reckon the problem lies in the length/size of a variable you've declared. Varchar(50) for example|||Here is the code:

Dim Con As ADODB.Connection

Set Con = New ADODB.Connection
Con.ConnectionString = "driver={SQL Server};server=OIVN303;uid=NIS_adm;pwd=nisdb04;dat abase=ZET"
Con.ConnectionTimeout = 3000
Con.Open

Set CreaConnessioneDB = Con

Dim Rs3 As ADODB.Recordset

Set Rs3 = New ADODB.Recordset
Rs3.CursorType = adOpenKeyset
Rs3.LockType = adLockOptimistic
Rs3.ActiveConnection = Con

Sql3 = "SELECT * T_NUM_E1_OMC_PER_OFFICE
Rs3.Open Sql3
If Not Rs3.EOF Then
Num_Tot_TRX = Rs3(0)
Num_Min_E1_GSM = Rs3(1)
End If
Rs3.Close

Set rs3 = nothing

...

Sorry, no attachment.

Thanks very much to everybody can help me!,
Bye,
Emanuela|||Sql3 = "SELECT * T_NUM_E1_OMC_PER_OFFICE

SURELY this is wrong.
No FROM and no closing quote (")?!|||Ok, I made a mistake during copy and paste:
Obviously the correct statement is:
Sql3 = "SELECT * FROM T_NUM_E1_OMC_PER_OFFICE"

A part from this, can you help me?|||That's it?

No Predicates?

Why not use Stored Procedures in any case?|||CreaConnessioneDB

Another typo?

Fancy pasting this loop you speak of that's causing the problem?sql

No comments:

Post a Comment