Showing posts with label object. Show all posts
Showing posts with label object. Show all posts

Monday, March 26, 2012

Microsoft OLE DB Provider for SQL Server error '80040e37'

I get Microsoft OLE DB Provider for SQL Server error '80040e37'

Invalid object name '#t_testTemp484883646'.
when I run the following ASP code:

Code is below

<!#Include File="../includes/adovbs.inc" -->

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>

<%
'-- Setup database connection
Set DataCmd = Server.CreateObject("ADODB.Connection")
Set rsData = Server.CreateObject("ADODB.RecordSet")
Dim varTempTableName
DataCmd.Open Application("DB")
'-- Use a Temp Table so that it gets destroyed automatically in case the page times out
'-- Use a Global Temp Table so that it is available across scopes when I open the record set below
'-- Append a semi unique number to the end because its global it could conflict with another browser running the same report
'varTempTableName = "##t_TestTemp" & Minute(Now()) & Second(Now())
varTempTableName = "#t_TestTemp" & Session.SessionID

strSQL = "Create Table " & varTempTableName & "(TestColumn2 int)"
DataCmd.Execute strSQL

strSQL = "select * from t_Test"
rsData.Open strSQL, DataCmd, adOpenForwardOnly,adLockReadOnly


Do While Not rsData.EOF
varTestColumn2 = rsData("TestColumn2")

'Error occurs when I place the following insert statement. Code works with the global variable

strSQL = "Insert into " & varTempTableName & " (TestColumn2) values (" & varTestColumn2 & ")"
DataCmd.Execute strSQL

rsData.MoveNext
Loop
rsData.Close

strSQL = "Drop Table " & varTempTableName
DataCmd.Execute strSQL

Set rsData = Nothing
Set DataCmd = Nothing
%>
</BODY>
</HTML>

If you have connection pooling enabled you will get *one* of the connection which *could* be actually not the same connection as this which created the temp table. So either use global temp tables (## instead of #) or disable connection pooling.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

Friday, March 23, 2012

Microsoft OLE DB Provider for SQL Server error '80004005' - Unspecified error

Hi,
I have an ASP code that calls a stored procedure. I use a Command
object to execute the stored procedure. The Stored procedure returns
data when executed in Query analyser. But it takes around 1 minute for
this. The stored procedure involves querying a huge amount of data.
When I try to open the ASP page, I get the following error :
Microsoft OLE DB Provider for SQL Server error '80004005'
Unspecified error
Any suggestions?
TIA,
AnishyaHi
Have you checked with SQL Profiler that the procedure is being called? Check
that the login/user you are using has the correct permissions. If this has
timed out then I would expect that a TIMEOUT error message. You may also want
to check http://www.aspfaq.com/show.asp?id=2009
John
"Ani" wrote:
> Hi,
> I have an ASP code that calls a stored procedure. I use a Command
> object to execute the stored procedure. The Stored procedure returns
> data when executed in Query analyser. But it takes around 1 minute for
> this. The stored procedure involves querying a huge amount of data.
> When I try to open the ASP page, I get the following error :
> Microsoft OLE DB Provider for SQL Server error '80004005'
> Unspecified error
> Any suggestions?
> TIA,
> Anishya
>|||Hi,
The procedure is being called in the Profiler. I tried executing the
same stored procedure call in query analyser and saw that it works
fine. The only problem is that it takes around 1 minute. So I am sure
this is why the ASP page gives the error. The stored proc makes the use
of a temporary table. I tried executing the stored proc by using a
permanent table instead of the temporary table. It doesnt take much
time. But doesn't permanent tables involve more performance overheads
than temporary tables? I am trying to find another alternative. Is
there any way that I could increase the timeout period for ASP pages?
Thanks,
Anishya|||Hi
You could be seeing contention on tempdb if a lot of people are
simulataneously creating temporary tables, see
http://support.microsoft.com/kb/328551. You should see if the temporary table
is really necessary or possibly use a table variable as an alternative.
You may also want to change the timeout on your command object
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdprocommandtimeout.asp
John
"Ani" wrote:
> Hi,
> The procedure is being called in the Profiler. I tried executing the
> same stored procedure call in query analyser and saw that it works
> fine. The only problem is that it takes around 1 minute. So I am sure
> this is why the ASP page gives the error. The stored proc makes the use
> of a temporary table. I tried executing the stored proc by using a
> permanent table instead of the temporary table. It doesnt take much
> time. But doesn't permanent tables involve more performance overheads
> than temporary tables? I am trying to find another alternative. Is
> there any way that I could increase the timeout period for ASP pages?
> Thanks,
> Anishya
>

Monday, March 12, 2012

Micorsoft ActiveX Data object could not be loaded

Hi all,

I wanna use the Microsoft ActiveX Data Object (Multi-dimensional)2.6 Library component
in my VB application, but it returns:
" 'C:\Program Files\Common Files\System\ado\msadomd.dll' could not be loaded "

How to solve this problem?
I am using:
SQL Server 2000 SP2
Analysis Service Sp2

RickYour dll is probably not registered properly. Try to unregister the dll and re-register it. Or download the ado 2.7 version and install it.|||I am running on win2k server, is it safe to use 2.7?
I'm now using MDAC 2.6 SP2 (2.62.7926.1)
thanks~

Rick|||If you feel uncomfortable installing 2.7, I would try unregistering the dll and re-registering. If that does not work, try to reinstall 2.6. One of the sps for sql server may update the dll, so make a note as to which version you are currently using - it may be as simple as an unregistered or corrupted dll.

Good luck.|||Thanks again!
I have use the MDAC Component Checker from the M$ website,
it seems that my version is 2.6 SP2 (2.62.7926.1) and
meets the version in register,

I have unreg and reg the dlls,
but I still got the following components errors:

1. Microsoft ActiveX Data Object (Multi-dimensional)2.6 Library Component
'C:\Program Files\Common Files\System\ado\msadomd.dll'
could not be loaded

2 OLAP Manager Cube Browser
'C:\...\Microsoft Analysis Services\Bin\msmdcb.ocx' could
not be loaded

I'm using SQL2000 Sp2, Analysis Services Sp2, VB 6 SP5
Will it look like a Ananlysis Services problem?

Rick|||Well, your last choices are to try re-install 2.6 and/or installing 2.7. What is the date/time size on these files which are failing ?

mgmnt studio express won't shrink .ldf files

I'm attempting to truncate/shrink a db (mdf & ldf) to be able to zip it and email it. From Object Explorer I select the db->tasks->shrink->files->filetype->log->release unused spage or reorganize->shrink file to (0mb). This action does not change the size of the .ldf file. Shrinking the mdf works just like SQL 2000 - as expected. Why don't the actions taken do what they imply for the .ldf file? If this is not what the selections mean, what do they mean?

thanks, jack

If you want the LDF to skrink to 0mb then you need to truncate the log because SQL Server in shrink mode reserves what was active log now called virtual log before releasing space to the OS. You can run DBCC Shrinkfile and see what error you get because 2005 now logs the error in the error log. Run a search for DBCC Shrinkfile and Truncate log in the BOL. Hope this helps.

|||Caddre, your response led me to information that explains the 'reality' of dealing with the logfile. In my case since I 'want' an empty db to distribute,I found that I could just detach the db, then delete the .ldf file. When I re-attach a 'new' empty log file is created. -- thanks, jack

MFC CDatabase and ODBC version

Hi all,

I created a CDatabase object, called OpenEx and checked the ODBC version with:

unsigned int version;

SQLGetEnvAttr(AfxGetHENV(),SQL_ATTR_ODBC_VERSION,&version,0,0);

and the version is 2. I want to make it 3 and I tried:

SQLSetEnvAttr(AfxGetHENV(),SQL_ATTR_ODBC_VERSION,(void*)SQL_OV_ODBC3,0);

It fails and I suppose it is because OpenEx already have an HDBC created. Does that mean I cannot use CDatabase and I have to write my own ODBC wrapper class? Thanks.

Kevin

You might be able to derive your own class from CDatabase and override AllocConnect adding the call to SQLSetEnvAttr.

MFC CDatabase and ODBC version

Hi all,

I created a CDatabase object, called OpenEx and checked the ODBC version with:

unsigned int version;

SQLGetEnvAttr(AfxGetHENV(),SQL_ATTR_ODBC_VERSION,&version,0,0);

and the version is 2. I want to make it 3 and I tried:

SQLSetEnvAttr(AfxGetHENV(),SQL_ATTR_ODBC_VERSION,(void*)SQL_OV_ODBC3,0);

It fails and I suppose it is because OpenEx already have an HDBC created. Does that mean I cannot use CDatabase and I have to write my own ODBC wrapper class? Thanks.

Kevin

You might be able to derive your own class from CDatabase and override AllocConnect adding the call to SQLSetEnvAttr.

Friday, March 9, 2012

Method Refresh of object ICrystalReportViewer3 Failed

Hi,
I am using CR 8, vb6 and protected access2000 .mdb database. In report viewer I used refresh method. But it is raising the runtime error -"Method 'Refresh' of object 'ICrystalReportViewer3' Failed".
Please help me.
Regards
Ashish AnandDo verify database and see|||I have problem with : " Method 'Refresh' of object ICrystalReportViewer3 Failed "

I did verify database but it show error

Please help me, immediate|||I have problem with : " Method 'Refresh' of object ICrystalReportViewer3 Failed "

I did verify database but it show error

Please help me, immediate
What is the new error you got?|||I try verify database more time and I try create new report , but it show error : Method 'Refresh' of object ICrystalReportViewer3 Failed

I think sure : function 'refresh' in CrystalReport 8 was failed

I click button(Refresh) in report then it run ok (have picture: storm)
I don't understand this

Please explain me clearly

Method EnumDatabaseMapping on Login SMO object takes 3 minutes

Hi,

The EnumDatabaseMapping call below takes upto 3 minutes on some SQL Servers whereas it takes hardly any time at all on others. What may cause such a long delay?

Regards,
Joginder Nahil
www.starprint2000.com

Private Sub OutputUserMapping(ByVal oLogin As Microsoft.SqlServer.Management.Smo.Login)

Dim colDatabaseMapping() As DatabaseMapping
colDatabaseMapping = oLogin.EnumDatabaseMappings

' Rest of the code has been deleted

End sub

Hi Joginder,

EnumDatabaseMappings is an expensive operation. SMO issues queries that iterate over all databases on the server and stores intermediate results in a temporary table. This might take time for a server with many databases and users, especially if under heavy load.

You can find out more by running SQL Server Profiler and inspecting the queries that are being sent to the server.

Arur Laksberg
SQL Server Team
Microsoft

|||

Hi Artur,

I am inclined to say that 3 minutes is a very long time in computer processing time (BTW my SQL Server is on the same computer as running the application and has 1GB memory + 3.6 Pentium 4 Processor+ there is nothing much else running) to enumerate just three databases AdventureWorks, Pubs and Northwind.

Regards,

Joginder Nahil
www.starprint2000.com