Hi,
I'm reaching the end of my tether here. I'm writing a Web Service application for my MCAD course in VS2003 which will connect to a SQL Server 2005 Express instance to access data. I can connect to the instance through the management suite, and through Visual Studio 2003. For some reason, when I try and manually connect through the web service, I get a page cannot be displayed error. When debugging, it falls over at the connection code. Here's what I have:
<appSettings>
<add key="ConnectionString" value="Integrated Security=SSPI;Initial Catalog=OfficeSupplies;Data Source=SGODRICH\SQLEXPRESS;"/>
</appSettings>
in web.config, and in my application:
// Create a connection to SQL Server Express
connection = new SqlConnection(ConnectionInfo);
// Upload Customer data to DataTable
dataadapter1 = new SqlDataAdapter("select * from Customers", connection);
dataadapter1.MissingSchemaAction = MissingSchemaAction.AddWithKey;
Customer_Data = new DataTable("Customers");
dataadapter1.Fill(Customer_Data);
The line in red is where the application falls over and I get a page cannot be displayed error. Any ideas why my application can't connect yet I can through both the manager and the IDE? I have enabled TCP, named pipes and shared memory. I have TCP dynamic port of 1053, I can connect using SQLCMD -S.\SQLEXPRESS from the command prompt (I get a 1> when I do this). I also have both services up and running. Anyone have any idea?
If the error happens in the red line, then your connection string is wrong. The error occurs in the constructor of the sqlconnection class not during connection which would be the .Open() method.HTH, jens Suessmeyer.
http://www.sqlserver2005.de|||Ooops. My apologies. I guess working so close to a problem blinds you to its issues. Its working fine now. Well, for now...
No comments:
Post a Comment