Connecting to SQL server 2000 with SQLDMO.DLL fails in windows 2003 server

i tried connecting to sql server using sqldmo.dll but it fails returning the following error. It works with win2k and winXP however.

Server Error in '/Metric' Application.
--------------------------------------------------------------------------------
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:

[COMException (0x80044818): [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.]
SQLDMO.SQLServerClass.Connect(Object ServerName, Object Login, Object Password) +0
Metric.SQLDBMO.ConnectToServer() in C:\Inetpub\wwwroot\Metric\Dataserver.vb:168
Metric.SQLDBMO..ctor() in C:\Inetpub\wwwroot\Metric\Dataserver.vb:157
Metric.Login.btnLogin_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\Metric\Login.aspx.vb:61
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValue
Collection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277

Public Class SQLDBMO
'Private mParams() As Object 'variant array for passing parameters
Private mblnConnected As Boolean
Private mCounter1 As Integer
Private mSQLServer As SQLDMO.SQLServer
Private mDB As SQLDMO.Database
Private moRole As SQLDMO.DatabaseRole
Private moSQLObjectList As SQLDMO.SQLObjectList
Private moQueryResults As SQLDMO.QueryResults
Private moPermission As SQLDMO.Permission
Private moDBObject As SQLDMO.DBObject
'Private mstrPermittedObjects() As String
Private mbLoadingQueries As Boolean ' true if user is not a member of db_owner and belongs to more than one role
Private mdtB2CL As DataTable
Private mNewRow As DataRow
Private moB2CL As IB2CLQueries
Private mstrB2CLQry_List() As String
Private gstrDBName As String = "Daddodb"
Public Sub New()
MyBase.New()
ConnectToServer()
End Sub
Private Sub ConnectToServer()
'On Error GoTo err_con
Dim sInstance As String = System.Configuration.ConfigurationSettings.AppSettings("InstanceName")
mSQLServer = New SQLDMO.SQLServer
With mSQLServer
.LoginSecure = True
.AutoReConnect = True
.Connect(sInstance)
mDB = .Databases.Item(gstrDBName)
End With
Exit Sub
err_con:
End Sub
 
Back
Top