Classified Car Kit Database Problem

Last post 06-28-2009 3:21 AM by Spider Master. 3 replies.

Sort Posts:

  • Classified Car Kit Database Problem

    06-27-2009, 12:34 PM
    • Member
      21 point Member
    • trivium
    • Member since 02-08-2005, 7:42 PM
    • Posts 9

     hi all,

    I created the database in MS SQL Server 2008 using the .sql files in App_Data folder, here is my connection string:

    <

    add name="Classifieds" connectionString="Server=(local);Integrated Security=True;Database=classifiedsdb;" providerName="System.Data.SqlClient" />

    however i am getting the following error:

    Object reference not set to an instance of an object.

    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.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    Line 1591:        private void InitConnection() {
    Line 1592:            this._connection = new global::System.Data.SqlClient.SqlConnection();
    Line 1593:            this._connection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["classifiedsConnection"].ConnectionString;
    Line 1594:        }
    Line 1595:        

     

    my question is: I want to remove the App_Data folder since i have created the database in my sql server, i don't need to attach the database file anymore. What do i need to do to get this working?

  • Re: Classified Car Kit Database Problem

    06-27-2009, 10:35 PM
    • Participant
      1,580 point Participant
    • Spider Master
    • Member since 10-16-2007, 1:32 PM
    • New Zealand
    • Posts 452

    This error is simply telling you the connection string is wrong. (local) is not a valid SQL Server Instance.

    If this is the first time you are attempting to build using VS directly with SQL server i would suggest Researching and understanding Sql server instances on your local machine as there is a lot more to using this approach than meets the eye.

    There are tutorials here on asp.net and information on msdn on how to connect a database directly to an instance of a local MSSQL server

     

     

    Trading Center is a New Classifieds Starter Kit on Code Plex.

    "If Your Question Has Been Answered, Please Mark It As the Answer"

  • Re: Classified Car Kit Database Problem

    06-28-2009, 12:05 AM
    • Member
      21 point Member
    • trivium
    • Member since 02-08-2005, 7:42 PM
    • Posts 9

     Thank you for your reply,

    I am researching different connection string and have not had luck so far. My specific question is:

    with regard to the classified start kit: I am using MS SQL Server 2008 and I already created the database and installed all tables and SPs. Can I remove the App_Data folder and all of its contents? since I am not attaching the database file and will not being instances

     

    please let me know.

    Thanks

     

  • Re: Classified Car Kit Database Problem

    06-28-2009, 3:21 AM
    Answer
    • Participant
      1,580 point Participant
    • Spider Master
    • Member since 10-16-2007, 1:32 PM
    • New Zealand
    • Posts 452

    I would not delete anything until you know you can access an instance of MS SQL Directly

    here is an example of the connection string you will need how ever using SQL server the way you wish to requires you to administor and set up MS SQL 2008 (typically there are training courses that take a few weeks to a month for this as there really is a lot to know before using production Data Servers) or if you are using an express version you (to my knowledge) simply can only use this for developemnt via attaching the .mdf

    Here is an example connection string! 3 sections in { } need replaced with your systems details

    <add name="{youConnectionStringName}" connectionString="Data Source=.{mssqlInstanceServerName};Initial Catalog={dataBaseCatalogName};Integrated Security=True" providerName="System.Data.SqlClient"/>


     

     

    Trading Center is a New Classifieds Starter Kit on Code Plex.

    "If Your Question Has Been Answered, Please Mark It As the Answer"

Page 1 of 1 (4 items)