locked
Classified Car Kit Database Problem RRS feed

  • Question

  • User-1928933298 posted

     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?

    Saturday, June 27, 2009 12:34 PM

Answers

  • User-122480877 posted

    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"/>


     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, June 28, 2009 3:21 AM

All replies

  • User-122480877 posted

    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

     

     

    Saturday, June 27, 2009 10:35 PM
  • User-1928933298 posted

     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

     

    Sunday, June 28, 2009 12:05 AM
  • User-122480877 posted

    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"/>


     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, June 28, 2009 3:21 AM