Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Error connecting to Sql server2000 using SQL-DMO and ASP.NET/VB.NET.


Message #1 by "Anders Dannberg" <nt4adb@a...> on Thu, 29 Nov 2001 15:10:28
I'm using Beta 2.



I'm currently calling the component (sqldmo.dll), or rather the metadata

file for it.



First, i'm calling the myfile.DLL (metadata for sqldmo.dll) file by 

creating

the metadata using

"tlbimp sqldmo.dll /out:myfile.dll" command.



Below is my code:

Line / code

----------------------------------

(import the filename using import namespace)

1. Dim srv As New myfile.SQLServer()

2. srv.Connect("myserver", "username", "password")

3. Dim objDB As New myfile.Database()

4.

5. For Each objDB In srv.Databases

6.      ' do stuff

7. Next

----------------------------------

or if i'm doing it i VS.NET beta2 and importing the sqldmo.dll in visual

studio.net it would be:

----------------------------------

1. Dim srv As New SQLDMO.SQLServer()

2. srv.Connect("myserver", "username", "password")

3. Dim objDB As New SQLDMO.Database()

4.

5. For Each objDB In srv.Databases

6.      ' do stuff

7. Next

----------------------------------



I notice that i am actually able to create the object (line 1), but when

adding line 2 however, trying to connect (line 2) it gives mes an error

(alert box):



ERROR MESSAGE: ---> Unknown software exception (0x80000003) occured ..

address 0x77fa018c. <--



I've tried it on two different machines (Win2000 Pro and Win2000 Advanced

Server) and both in a Windows VB.NET app and ASP (vb.net) application.

Nothing works, it's still gives the same error.



Is this a bug or am i doing something wrong here?

Should the SQL-DMO objects be called in a different way in .NET ??

Also, it does matter not wheather i use the "tlbimp" command line utility 

or

import it using VS.NET (

Project | Add Reference | COM). It's still produces the same error.



I've tried calling other COM components this way and it works fine, the 

only

thing that does not work

so far is when actually using the CONNECT method to a SQL Server in the

SQL-DMO object.



Thankful for any kind of help on this issue.



.. Anders




  Return to Index