Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 Login failed for user 'sa'

Author  Topic 

rotemblu
Starting Member

2 Posts

Posted - 2010-01-08 : 14:49:52
I am trying to access a sql databse using c# by the following program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
SqlConnection myConnection = new SqlConnection("user id=sa;" +
"password=password;server=localhost;" +
"Trusted_Connection=no;" +
"database=date; " +
"connection timeout=30");
try
{
myConnection.Open();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
System.Threading.Thread.Sleep(100000);
}
}
}
}

but I get an error:
Login failed for user 'sa'
the failed login is not listed in the error log file(although auditing is configured and logging in from managment studio is listed)
I can access the databse using sql managment studio with that login(sa).
thanks
rotem blumberg

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-01-08 : 14:58:51
that's the entire error message returned by the app?

look in the windows event logs for details on failed login.
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2010-01-08 : 16:06:43
Is that the only account you can't connect to?For example ,can you connect with any other logon account?


Jack Vamvas
--------------------
http://www.ITjobfeed.com
Go to Top of Page
   

- Advertisement -