Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can't connect to local SQL Server
Message
Information générale
Forum:
ASP.NET
Catégorie:
Web Services
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Database:
MS SQL Server
Divers
Thread ID:
01045539
Message ID:
01045566
Vues:
15
Daniel;

Can you list the errors that are being thrown?

Does this work for you?
this.sqlConnection1.ConnectionString = "integrated security=SSPI;data source=(local);persist security info=False;initial catalog=Northwind";
Tom


>Once again, the simplest of VS.Net tasks seems to be kicking my backside.
>
>I'm trying to set up a simple web service that connects to a local SQL Server instance and the ever-popular Northwing database. The SERVICE1.asmx.cs is as follows:
>
>
>using System.Web.Services;
>using System.Data;
>using System.Data.SqlClient;
>
>public class Suppliers: WebService
>{
>	private System.Data.SqlClient.SqlConnection sqlConnection1;
>
>	private void InitializeComponent()
>	{
>		this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
>		//
>		// sqlConnection1
>		//
>		this.sqlConnection1.ConnectionString = "integrated security=SSPI;data source=\"(local)\";persist security info=False;initial catalog=Northwind";
>
>	}
>
>	[ WebMethod() ]
>	public DataSet GetAllSuppliers()
>	{
>		
>		SqlCommand cmd = new SqlCommand("select * from Suppliers", this.sqlConnection1);
>		SqlDataAdapter adapter = new SqlDataAdapter(cmd);
>		DataSet dsSuppliers = new DataSet();
>
>		this.sqlConnection1.Open();
>		adapter.Fill(dsSuppliers, "Suppliers");
>		this.sqlConnection1.Close();
>
>		return dsSuppliers;
>	}
>}
>
>
>When I try to test the service, it appears to come to life with the default pages. However, I click the "invoke" button and get an HTTP 500 error. Stepping through the code, the error occurs when the connection object opens.
>So, I'm guessing it is some kind of security issue, but I haven't a clue as to what. Teh Google, she no help.
>
>I've tried this against a server that requires a UID and password, instead of Windows authentication, with the same result.
>
>Anyone have any clues?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform