Showing posts with label failure. Show all posts
Showing posts with label failure. Show all posts

Friday, March 30, 2012

Instance Failure: SqlDataSource

I'm trying to populate a DropDownList with data from an SQL table (called StrataPlans). I'm getting an instance failure from the following code:

<

asp:SqlDataSourceID="dataSource"runat="server"ConnectionString="Server=BEN-TOSH\\SQLEXPRESS; TRUSTED_CONNECTION=YES; database=OSMSQL"SelectCommand="SELECT * FROM StrataPlans"ProviderName="System.Data.SqlClient"SelectCommandType="Text"/>

<asp:DropDownListID="spList"DataSourceID="dataSource"runat="server"/>

I've tested the connectionstring/select query in another of my applications and it works ok...can anyone point me in the right direction as to how to resolve this?

Thanks

Hmm,

That seems odd; an instance failure would be with creating the obect I would think. Could you provide the details of the error message?

Instance failure.

why I am getting (Instance failure.) when trying to connect to sql server from the web.config connectionstring..

the web.config entry is :

<connectionStrings>

<addname="website_connectionstring"connectionString="Data Source=.\\SQLEXPRESS;initial catalog=zatoor;integrated security=true"providerName="System.Data.SqlClient" />

<!--

<remove name="website_connectionstring"/>

<add name="website_connectionstring" connectionString="Server=whsql-v21.prod.mesa1.secureserver.net;Database=DB_143379;User ID=zatoor;Password=Mujtaba2007;Trusted_Connection=False" providerName="System.Data.SqlClient" />

-->

</connectionStrings>

the code is :

sql_connection =newSqlConnection(ConfigurationManager.ConnectionStrings["website_connectionstring"].ToString());

sql_connection.Open();

It looks you have provided wrong data source .. to confirm this login to sql management studio and check it should be

YouMachineName\SQLEXPRESS confirm the same and update the connectionString

This will solve the problem

Satya

sql