Click to See Complete Forum and Search --> : Problem connecting to sql with C# and ASP.NET


avivhal
May 23rd, 2004, 03:46 PM
Hi,

I have the following problem:

I downloaded Microsoft sql server 2000 MSDE Service pack 3 (sql2ksp3).

Then I installed it with the command line :
setup SECURITYMODE=SQL SAPWD="sa"

Next I tried to open a connection to a database from an ASP.NET using C#.
I tried to use the following to connect:
OleDbConnection conn = new OleDbConnection(@"Provider=SQLOLEDB;User ID=sa;Initial Catalog=master;Data Source=(local);");

conn.Open();

this failed with the error:Login failed for user 'sa'

then I tried this:
OleDbConnection conn = new OleDbConnection(@"Provider=SQLOLEDB;Integrated Security=SSPI;User ID=sa;Initial Catalog=master;Data Source=(local);");

conn.Open();

this failed with the error :Login failed for user 'HOME-35NVKYBV8B'
were 'HOME-35NVKYBV8B' is my local host name



Please help me if you have an answer.I've read every possible doc I could find but could not find the answer!

Thanks.


avivhal