473,382 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user ' '.

Hi,
I am working on a project to script all database objects.The code
below works fine on my machine( windows XP ) and all the creates all
the db objects.

But I get an error message when I run it on a server( windows server
2003).

The first part of the code where I am executing sp_dboption and
getting all the options set for the database is working fine and it
creates the required script , but the piece of code using the SQLDMO
to get the database objects is where I am getting the error.

Thanks

Srini

Code Listing :-

public class ScriptAndCreateDataBases
{
public void ConnectAndScriptDatabases( SQLServer2Class server )
{

server.LoginSecure = true;
server.Connect( server.Name , "sa" , "" ) ;

- - - -
foreach (Database2 d in databases )
{

ConnectAndGetOptions( server , d.Name, options);
ScriptDBObjects dbobj = new ScriptDBObjects();
dbobj.Initialize(server, d);
}

- - - -
public class ScriptDBObjects
{
private SQLServer2Class m_sqlserver;
public void Initialize(SQLServer2Class ssc , Database2 db )
{
m_sqlserver = new SQLServer2Class() ;
m_sqlserver = ssc ;
---
}

private void ScriptDatabase(Database2 db , SQLServer2Class server
{
case Db_Types.Defaults:
s_transfer.CopyAllDefaults = true;
GenerateScript(s_transfer, workingFolder, db );
}

private void GenerateScript(TransferClass tc, string folder, Database2
db )
{

--erroring out db.ScriptTransfer(tc,
SQLDMO_XFRSCRIPTMODE_TYPE.SQLDMOXfrFile_SingleFile PerObject, folder);
}
Nov 16 '05 #1
1 9372
>But I get an error message when I run it on a server( windows server
2003).

server.LoginSecure = true;
server.Connect( server.Name , "sa" , "" ) ;


Most likely, your server's SQL database is protecting the "sa" account
(System Administrator) with a password..... that's why your login
fails (I think).

Marc
================================================== ==============
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andrew J Durstewitz | last post by:
I've noticed a few times yesterday I recived this error on my web server: SQL Server does not exist or access denied. I know for sure the server is running and at the time was under a load...
10
by: FreeOperator | last post by:
Dear all, On Win2000 server with SP3, I am trying to access a SQL Server 7.0 database, "TestDB", from VB6 via a SQL Server ODBC system DSN using ADO 2.7. In SQL Server Enterprise Manager, there...
6
by: kai | last post by:
Hi, All I use SQL Server 2000 and Win 2003 Server. I try to create a SQL Server Login audit log using Profiler, but cannot find the tools. I looked at the Windows Event Viewer, it only logs...
8
by: Dakkar | last post by:
I wrote a program with c# for connecting mysql and taking data from it but when someone without me try to execute the program they are taking this error ERROR Data source name not found and...
0
by: bazzer | last post by:
hey, i am using visual basic.net 2003 and have an ASP.NET webform application thats accessing a microsoft access 2003 database. i kept getting the following error when i tried to run it: ERROR ...
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
2
by: MrByte | last post by:
Hi Folks, I'm having a strange situation here between 2 Linked MS SQL 2K servers. One of the servers died recently and I rebuilt it. All seems to be working fine, except that when I create...
11
by: Anil Gupte | last post by:
I am getting the following error: ********* Login failed for user 'AUM\ASPNET'. Description: An unhandled exception occurred during the execution of the current web request. Please review the...
1
by: byrocat | last post by:
Can anyone give a quick description of the meaning of this message and what needs to be done to get a connection. I'm running DBArtisan with SQLServer 2000 client SP4 installed. I also get the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.