Asp.net problem with sql server

G

Guest

public void BindGrid()
{
SqlConnection myConnection = new
SqlConnection("Server=Server;database=MyDatabase;UID=xyz;PWD=123456;Trusted_Connection=Yes"); Or
and i tried with "Server=Server;database=MyDatabase;Trusted_Connection=Yes");

myConnection.Open();

SqlDataAdapter myCommand = new SqlDataAdapter("select * from dbo.table1",
myConnection);
DataSet ds = new DataSet();
myCommand.Fill(ds, "dbo.table1");

DataGrid1.DataSource=ds.Tables["dbo.table1"].DefaultView;
DataGrid1.DataBind();

myConnection.Close();

}
I get that error
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: Login failed for user
'(null)'. Reason: Not associated with a trusted SQL Server connection

i am running web on local and sql server on different server using sql
server 2005 with .net 2003 and windows pro with sp2
 
J

Jeff Dillon

If you are browsing from the same server where IIS is located, then NT Auth
will work. Otherwise, use only Basic Auth

jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top