Almost working... I Think I need help with connection string. RRS feed

  • Question

  • User-797531878 posted
    Well, thanks to many of the posts I have been able to get much closer than I was a couple weeks ago.  I need a little help to figure out the last little bit of this Club web site.

    I have done the following.

    - I downloaded Visual web developer and club template
    - downloaded SQL express and SQL server management studio express
    - I ran asp.net configuration to setup user and roll
    - I found a hosting company to host my site with .net 2.0
    - Uploaded to the hosting site
    - also have SQL 2005 site with same hosting company.  On a different server.
    - I did the items listed on this link to put the club tables and aspnetdb tables all on one server.  My SQL Server 2005 site only allows one database.  http://forums.asp.net/1106750/ShowPost.aspx 
    - I modified my connection string in the web.config file to point at the sql server 2005.  Here it is (I adjusted the IP address and password for obvious reasons.)

    <add name="ClubSiteDB" connectionString="Data Source=;Initial Catalog=jeromefa2;Persist Security Info=True;User ID=jeromefa2;Password=*******" providerName="System.Data.SqlClient" />

    Now I get this error message.  At one point I did run the club site from my computer with success. Can somebody please help me get this thing up and running?  I have been trying for a couple weeks now. I know I am close and help would be much appreciated.  I would like to unveil it on Thanksgiving to the family. 

    Server Error in '/JeromeFamilyClub' Application.

    Invalid object name 'dbo.Events'.
    Invalid object name 'dbo.Locations'.
    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: Invalid object name 'dbo.Events'.
    Invalid object name 'dbo.Locations'.

    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. 

    Stack Trace:

    [SqlException (0x80131904): Invalid object name 'dbo.Events'.
    Invalid object name 'dbo.Locations'.]
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +95
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +82
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +346
       System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +3244
       System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +52
       System.Data.SqlClient.SqlDataReader.get_MetaData() +130
       System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +371
       System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1121
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +334
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +45
       System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +162
       System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +35
       System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +32
       System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +183
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +307
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +152
       System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +2866
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +84
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +154
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +99
       System.Web.UI.WebControls.GridView.DataBind() +24
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +91
       System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +101
       System.Web.UI.Control.EnsureChildControls() +134
       System.Web.UI.Control.PreRenderRecursiveInternal() +109
       System.Web.UI.Control.PreRenderRecursiveInternal() +233
       System.Web.UI.Control.PreRenderRecursiveInternal() +233
       System.Web.UI.Control.PreRenderRecursiveInternal() +233
       System.Web.UI.Control.PreRenderRecursiveInternal() +233
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4437

    Monday, November 21, 2005 1:26 AM

All replies

  • User1900542555 posted
    When the database was created on the SQL2005 server, 'dbo' may not have been the user that created the database tables. Instead, like in many shared hosting environments, the tables were probably created using your user account on that database server. So the table names would technically be referenced as 'youraccountname.tablename'. However, I've noticed in some places within the club site code that the table names are explicitly referenced as 'dbo.tablename' rather than just 'tablename'. Well, that will definitely cause a problem if the 'dbo' user didn't create the table you're trying to reference.

    to fix this:
    1) either re-create the tables in the SQL2005 database using the 'dbo' user (you may not even have the proper permissions to do this)
    2) (the better option, imho) fix the code on the pages in question by adjusting the SQL queries so they don't prefix table names with 'dbo'.

    good luck and hope this helps!
    Monday, November 28, 2005 12:17 PM