PDA

View Full Version : Could not open a connection to SQL Server


mainiabhay
07-17-2009, 06:58 AM
Hi guys,

I changed my connection string by changing the database name, it showed me the error saying Could not open a connection to SQL Server
Then i again changed the string back to what it originally was (what was working) it agian give me the same error.

So even though its wroking fine on local web server its not working over the web.

i got a reply from ASPDISCOUNT.NET saying i should check my weconfig file string, which is fine.

It produces an error in XSD, i replaced that too with the right one but still not resolved.
Please help.

wisemx
07-17-2009, 07:01 AM
Hi,
OK...First I have to ask, are you trying to get a SQL Express DB on-line?
All the best,
Mark

mainiabhay
07-17-2009, 07:09 AM
I didn't get you?
we have SQL server 2000 enterprise edition here, and its been working for 6 months now until i changed the query string from:

<connectionStrings>
<add name="RevisionConnectionString" connectionString="Data Source=SQLSERVER2;Initial Catalog=Revision;Integrated Security=True" providerName="System.Data.SqlClient"/>

</connectionStrings>

to:


<connectionStrings>
<add name="RevisionConnectionString" connectionString="Data Source=SQLSERVER2;Initial Catalog=Revisionold;Integrated Security=True" providerName="System.Data.SqlClient"/>

</connectionStrings>


it didn't work.

then i changed it back to

<connectionStrings>
<add name="RevisionConnectionString" connectionString="Data Source=SQLSERVER2;Initial Catalog=Revision;Integrated Security=True" providerName="System.Data.SqlClient"/>

</connectionStrings>


and it still didnt work

wisemx
07-17-2009, 07:26 AM
Hi,
The reason I asked is that most of the Conn string questions in this forum are directed at issues with moving from Express to Web. ;-)

Here's a valid Conn section, from my own web.config, showing what works.
(Just replace the values listed, server, username, password.)
All the best,
Mark

<connectionStrings>
<clear />
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=tcp:sql.discountasp.net;Initial Catalog=SQL_msftwise;User ID=SQL_msftwise_user;Password=****" providerName="System.Data.SqlClient" />
<remove name="SQL_msftwise_userConnectionString"/>
<add name="SQL_msftwise_userConnectionString" connectionString="Data Source=tcp:sql.discountasp.net;Initial Catalog=SQL_msftwise;Persist Security Info=True;User ID=SQL_msftwise_user;Password=****" providerName="System.Data.SqlClient" />
</connectionStrings>

mainiabhay
07-17-2009, 08:26 AM
Mark,

i tried this

<connectionStrings>
<clear />
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=tcp:sql.discountasp.net;Initial Catalog=SQL_msftwise;User ID=SQL_msftwise_user;Password=****" providerName="System.Data.SqlClient" />
<remove name="RevisionConnectionString"/>
<add name="RevisionConnectionString" connectionString="Data Source=SQLSERVER2;Initial Catalog=Revision;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>


It didn't work, since we do not have passwords n user id do you i should replace my original string?

wisemx
07-17-2009, 09:10 AM
Hi,
Log into your DASP Control Panel and take a look in the section for the SQL Server addon you have, there is a full connection string with your needed info but the password is commented out, just replace that with password from your DASP account.
Don't use the exact string I posted, you need to replace the Data Source, Catalog, User ID and Password...with your own to make it work.

If you get stuck and need further help PM me with your account login and I'll write the needed conn string for you and PM it back.
All the best,
Mark

mainiabhay
07-17-2009, 11:15 AM
Mark, please check my PM.

wisemx
07-17-2009, 01:40 PM
..Just sent your a return PM ;-)