Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ConnectionString error

Status
Not open for further replies.

mxo

Programmer
May 20, 2005
51
ZA
Hi pls help i have uploaded the site files to the server and when i try it I get the following error:
I am using the Microsoft SQL Express as the database.

Server Error in '/' Application.
--------------------------------------------------------------------------------

Invalid value for key 'attachdbfilename'.
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.ArgumentException: Invalid value for key 'attachdbfilename'.

Source Error:


Line 46:
Line 47: Public Shared Function ExecuteScalar(ByVal sql As String) As Object
Line 48: Dim cnn As SqlConnection = New SqlConnection(strConn)
Line 49: Dim cmd As SqlCommand = New SqlCommand(sql, cnn)
Line 50: cnn.Open()


Source File: C:\Inetpub\vhosts\ruralboy.co.za\httpdocs\App_Code\SqlHelper.vb Line: 48

Stack Trace:


[ArgumentException: Invalid value for key 'attachdbfilename'.]
System.Data.SqlClient.SqlConnectionString.VerifyLocalHostAndFixup(String& host, Boolean enforceLocalHost, Boolean fixup) +811724
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +2207
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +200
System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +62
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
System.Data.SqlClient.SqlConnection..ctor(String connectionString) +24
DAL.SqlHelper.ExecuteScalar(String sql) in C:\Inetpub\vhosts\ruralboy.co.za\httpdocs\App_Code\SqlHelper.vb:48
Statsl.Page_Load(Object sender, EventArgs e) in C:\Inetpub\vhosts\ruralboy.co.za\httpdocs\Stats.ascx.vb:8
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

 
looks to be a problem with the connection string.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Hi Jason, i manage to sort out the above issue now the site is up but when i want to access a adminpage with login details i get the following server error:

Server Error in '/' Application.
Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.

see my connectionstring from web.config file:
<add name="ConnectionString" <add name="ConnectionString" connectionString="Server=255.255.255.255\SQLEXPRESS;Database=ruralboy_BlogDb;Uid=#$$$$$$;Pwd=#####;" providerName="System.Data.SqlClient"/>
<add name="aspnet" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf"/>

and the connectionstring on the page that Im trying to access is as follow: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString"=<%$ ConnectionStrings.ConnectionString%>"

I think the issue has to do with my conntionstring, please help
 
my guess is
.\SQLExpress
is the problem as there probably is not a local instance of sqlexpress installed on the production server. and if there is this setting
Integrated Security=True;
is another problem because this only works with windows authentication.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top