sql 2005 connection issue

J

JD

Hello,

I am dealing with an issue, that although probably simple, is driving me
crazy. I am trying to connect to a SQL 2005 Express database through a web
service using the following code:

[WebMethod]
public XmlDocument GetAllAuthors()
{
XmlDocument doc = new XmlDocument();
DataSet prjDataSet = new DataSet("ProjectStatus");
using (SqlConnection conn = new
SqlConnection("server=UA13098;uid=user;pwd=pass;database=forms;"))
{
SqlDataAdapter adapter = new SqlDataAdapter("Select
id,name,text, from prjstatus ", conn);
adapter.Fill(prjDataSet, "ProjectStatus");
}
doc.LoadXml(prjDataSet.GetXml());
return doc;
}

The problem is that I keep receiving an error that states: Login for 'user'
failed.....and it contains no further information. I can log into the SQL
console with the account just fine, and access the forms database. The
problem is only occurring when I try to access the database from the web
service.

Any suggestions are mosted appreciated.

Thanks
 
R

Rob Pollard

Not sure if this is your problem but... With my set-up I can only have one
connection at a time. I find that if I leave VS server browser connected I
get the same message when trying to run the application in the dev
environment. To get around this I just make sure that I disconnect the
connection in the server view prior to running the app and this seems to
work fine.
 
J

JD

Rob,

Thanks for the reply....this is not my issue. When I receive the error, I
do not have any other connections present.

I assume that my error is at the database, and not the code...not sure
though.

JD

Rob Pollard said:
Not sure if this is your problem but... With my set-up I can only have one
connection at a time. I find that if I leave VS server browser connected I
get the same message when trying to run the application in the dev
environment. To get around this I just make sure that I disconnect the
connection in the server view prior to running the app and this seems to
work fine.

--
RobP
'There are only 10 types of people in this world - Those that understand
binary and those that don't'

JD said:
Hello,

I am dealing with an issue, that although probably simple, is driving me
crazy. I am trying to connect to a SQL 2005 Express database through a
web service using the following code:

[WebMethod]
public XmlDocument GetAllAuthors()
{
XmlDocument doc = new XmlDocument();
DataSet prjDataSet = new DataSet("ProjectStatus");
using (SqlConnection conn = new

SqlConnection("server=UA13098;uid=user;pwd=pass;database=forms;"))
{
SqlDataAdapter adapter = new SqlDataAdapter("Select
id,name,text, from prjstatus ", conn);
adapter.Fill(prjDataSet, "ProjectStatus");
}
doc.LoadXml(prjDataSet.GetXml());
return doc;
}

The problem is that I keep receiving an error that states: Login for
'user' failed.....and it contains no further information. I can log into
the SQL console with the account just fine, and access the forms
database. The problem is only occurring when I try to access the database
from the web service.

Any suggestions are mosted appreciated.

Thanks
 

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