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
 General SQL Server Forums
 New to SQL Server Programming
 can't acces

Author  Topic 

franches202
Starting Member

4 Posts

Posted - 2005-10-26 : 03:33:31
my colleague is using visual studio (VB) and making windows applications. we used same connection string but i can't connect to the sql server.

i am using visual studio(2003) .net(C#) and making web applications. this is the code.

System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection ();
// TODO: Modify the connection string and include any
// additional required properties for your database.
//conn.ConnectionString = "integrated security=SSPI;data source=cerebrum;persist security info=False;initial catalog=dals";
conn.ConnectionString="Server=cerebrum;Initial Catalog=dals;User Id=sa;";
try
{
conn.Open();
// Insert code to process data.
Label1.Text="Connection successful";
}
catch (Exception ex)
{
throw ex;
}
finally
{
conn.Close();
}


and i'm getting this error
SQL Server does not exist or access denied.
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.Data.SqlClient.SqlException: SQL Server does not exist or access denied.

Source Error:


Line 91: throw ex;
Line 92: }
Line 93: finally


activecrypt
Posting Yak Master

165 Posts

Posted - 2005-10-26 : 04:13:44
Hi,

this is a list y get this error :

http://support.microsoft.com/?kbid=888228

http://support.microsoft.com/default.aspx?scid=kb EN-US Q328306


HTH

-----------------------------------------------------------
MSSQL Server encryption software http://www.activecrypt.com
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2005-10-26 : 04:20:06
I dont know whether the solutions works for you..

instead of User ID try to use UID for the user id..
and
also in the Excption try to do following things..

ex.ToString();

and get the error details.. post on google.. it may help u

Complicated things can be done by simple thinking
Go to Top of Page

franches202
Starting Member

4 Posts

Posted - 2005-11-03 : 07:41:19
quote:
SqlConnection connection = new SqlConnection();
connection.ConnectionString="UID=sa;Initial Catalog=dals;Data Source=cerebrum;";
try
{
connection.Open();
Label1.Text = "SQL Connection is open";
}
catch (Exception exp)
{
Trace.Write(exp.ToString());
throw exp;
}
finally
{
connection.Dispose();
}


this is the message i got:
SQL Server does not exist or access denied.
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.Data.SqlClient.SqlException: SQL Server does not exist or access denied.

Source Error:


Line 58: {
Line 59: Trace.Write(exp.ToString());
Line 60: throw exp;
Line 61: }
Line 62: finally


Source File: e:\inetpub\wwwroot\webapplication6\webform1.aspx.cs Line: 60

Stack Trace:


[SqlException: SQL Server does not exist or access denied.]
WebApplication6.WebForm1.Page_Load(Object sender, EventArgs e) in e:\inetpub\wwwroot\webapplication6\webform1.aspx.cs:60
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()



Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-04 : 04:51:31
See if this helps you
www.ConnectionStrings.com

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -