This project has moved and is read-only. For the latest updates, please go here.

SQL error

May 27, 2011 at 9:47 PM

Hi there,

I've installed nsurvey on my local machine successfully. So the default page loads fine, but the issue is with the sql database when try to login. I get the following error which is irrelevant to my settings.

The database was created successfully using "Survey123_ExistingDBInstall" query file.

 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +6277312
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +412
   System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity) +6291674
   System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) +180
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +6292062
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +6291977
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +352
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +831
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +49
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +6293782
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +78
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1922
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +89
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +6296606
   System.Data.SqlClient.SqlConnection.Open() +300
   Microsoft.ApplicationBlocks.Data.SqlHelper.FillDataset(String connectionString, CommandType commandType, String commandText, DataSet dataSet, String[] tableNames, SqlParameter[] commandParameters) +120
   Votations.NSurvey.SQLServerDAL.User.GetNSurveyUserData(String userName, String password) +362
   Votations.NSurvey.WebAdmin.Login.ValidateCredentialsButton_Click(Object sender, EventArgs e) +185
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +154
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3691

 

here's my connectionString:

<connectionStrings>
        <remove name="LocalSqlServer" />
        <!--<add connectionString="data source=.\HS-PC\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|NSurvey.mdf;User Instance=true" name="LocalSqlServer" providerName="System.Data.SqlClient" />-->
    <add connectionString="Server=SQLEXPRESS;Database=NSurvey;User ID=*******;Password=*******" name="NSurveyConnectionString" providerName="System.Data.SqlClient" />
     </connectionStrings>
	<appSettings>
    <add key="NSurveyConnectionString" value="Server=SQLEXPRESS;Database=NSurvey;uid=*******;pwd=*******" />
	</appSettings>
This is the only change I made to the web.config file.
I got the same error when I deployed NSurvey on a remote server!
Please advise.
Thank you very much

Server Error in '/nsrvey-1.2.3' Application.

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

May 28, 2011 at 9:23 AM

Hello,

You must have downloaded the source code of one of the earlier versions of survey 1.2.3. Please use the latest release or the latest source code. As you will notice all lines in the web.config file  between   <connectionStrings>
    </connectionStrings> are removed. The actual connectionstring is at <nSurveySettings> :    

<!--        <add key="NSurveyConnectionString" value="server=(local);Integrated Security=SSPI;database=nsurvey" /> -->
        <add key="NSurveyConnectionString" value="Server= ;Database= ;uid= ;pwd= "/>

This should solve your problem.

Kind regards,
Fwsmaster

Jun 3, 2011 at 8:59 PM

Thank you for your recent reply,

I've downloaded the latest version and added <add key="NSurveyConnectionString" value="Server= ;Database= ;uid= ;pwd= "/> inside the <nSurveySettings> tags as described. But I still get the same error, both in my local machine and remote server!

Is there a specific securtiy setting that needs to be applied?

This is what I have at this point

Security Settings:
<input id="ctl02_ctl00_ctl00_webSitesHomeFolderControl_chkWrite" checked="checked" name="ctl02$ctl00$ctl00$webSitesHomeFolderControl$chkWrite" type="checkbox" value="on" /><label for="ctl02_ctl00_ctl00_webSitesHomeFolderControl_chkWrite">Enable Write Permissions</label>
<input id="ctl02_ctl00_ctl00_webSitesHomeFolderControl_chkDirectoryBrowsing" name="ctl02$ctl00$ctl00$webSitesHomeFolderControl$chkDirectoryBrowsing" type="checkbox" value="on" /><label for="ctl02_ctl00_ctl00_webSitesHomeFolderControl_chkDirectoryBrowsing">Enable Directory Browsing</label>
<input id="ctl02_ctl00_ctl00_webSitesHomeFolderControl_chkParentPaths" checked="checked" name="ctl02$ctl00$ctl00$webSitesHomeFolderControl$chkParentPaths" type="checkbox" value="on" /><label for="ctl02_ctl00_ctl00_webSitesHomeFolderControl_chkParentPaths">Enable Parent Paths</label>

 

Authentication:
<input id="ctl02_ctl00_ctl00_webSitesHomeFolderControl_chkAuthAnonymous" checked="checked" name="ctl02$ctl00$ctl00$webSitesHomeFolderControl$chkAuthAnonymous" type="checkbox" value="on" /><label for="ctl02_ctl00_ctl00_webSitesHomeFolderControl_chkAuthAnonymous">Allow Anonymous Access</label>
<input id="ctl02_ctl00_ctl00_webSitesHomeFolderControl_chkAuthWindows" checked="checked" name="ctl02$ctl00$ctl00$webSitesHomeFolderControl$chkAuthWindows" type="checkbox" value="on" /><label for="ctl02_ctl00_ctl00_webSitesHomeFolderControl_chkAuthWindows">Enable Integrated Windows Authentication</label>
<input id="ctl02_ctl00_ctl00_webSitesHomeFolderControl_chkAuthBasic" name="ctl02$ctl00$ctl00$webSitesHomeFolderControl$chkAuthBasic" type="checkbox" value="on" /><label for="ctl02_ctl00_ctl00_webSitesHomeFolderControl_chkAuthBasic">Enable Basic Authentication</label>
Jun 7, 2011 at 10:17 PM

Very strange...

I cleared the password which was correct to begin with and re-entered it and Voila. It works.

Jun 7, 2011 at 10:52 PM

It's good to hear you got it working!

Jun 8, 2011 at 1:03 AM

Thank you fwsmaster ;)

Great work... by the way how do I insert a matrix question?

 

Regards

Jun 8, 2011 at 1:13 AM

Nevermind...