frustrated can't see my tiny database .mdf

Discussion in 'Databases' started by brea245, May 7, 2009.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Like, I can't seem to get the correct connectionstrings for my DASP SQL2008 server.

    So according to Connection Strings .com this is the code to connect:

    Attach a database file, located in the data directory, on connect to a local SQL Server Express instance

    Server=.\SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf; Database=dbname;Trusted_Connection=Yes;

    -or-

    Attach a database file on connect to a local SQL Server Express instance

    Server=.\SQLExpress;AttachDbFilename=c:\asd\qwe\mydbfile.mdf;Database=dbname; Trusted_Connection=Yes;

    I'm using this connectionstring code:

    <removename="authorConnectionString" />
    <
    addname="authorConnectionString"connectionString="Data Source=tcp:sqlXXX.discountasp.net;Initial Catalog=App_Data/author.mdf;User ID=SQL2008_XXXXXX_XXXX_user;Password=XXX"providerName="System.Data.SqlClient"/>

    RESULT: Cannot open database "App_Data/author.mdf" requested by the login. The login failed.
    Login failed for user 'SQLXXX_XXXX_XXX_user'.


    So, have no clue as to how to code my web.config file to get DASP SQL 2008 server to connect to my .mdf appreciate if someone can assist.

    thanks....
     
  2. attach db connectionstring code to web.config

    I already followed these instructions. Since I'm migrating from SQL2005 to> SQL2008. Do you suggest I delete App_Data and App_Code folders on my website and upload App_Data and App_Code folders again? Then
    in SQL 2008 control Panel use the attach mdf file tool.

    Again, no explanation on how I'm to use the MS SQL 2008 Server Information > Connection String.

    Aren't you suppose to specify the exact dataset name, in my case it's [/App_Data/author.mdf] in the Connection String?? Does this name go under the Initial Catalog=[/App_Data/author.mdf] ??

    I'm not coding the connection string properly and wish someone who has had this problem can coach me to correct this problem.

    Or do I restore my whole db to default state??

    Wish computing had less tasks/steps procedures to follow-whew!
     
  3. You do not need to delete your folders App_Data and App_Code when using the SQL Management Tool. Infact you can upload the backup of your database anywhere in your root. We only suggested these folders because they have inherent permissions built in that will prevent browsers from downloading them.

    Also your connection string is a little off. You can't set the connection string to try and query a .mdf file. It needs to be loaded to a SQL server then you query the database on that SQL server. Try using this connection string name as a guideline. Replace the server names, and database names with the appropriate values.

    <connectionStrings>
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer" connectionString="Data Source=DBServerName;Integrated Security=false;Initial Catalog=DBName;User ID=DBLogin;Password=DBPassword" providerName="System.Data.SqlClient" />
    </connectionStrings>

    If you have ASP websites, you may also want to check these kb articles for some example codes on how to create a connection string. Once again you will need to replace the parameters with your own values.

    https://support.discountasp.net/KB/...with-asp-using-dsn-less.aspx?KBSearchID=33375
     
  4. I set the proper parameters to my connectionstring just like you wrote and I still get this error. Have no clue as to why this is happening unless I have to Initial catalog the whole webroot and directory of my .mdf file:

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

    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 1556: private void InitConnection() {
    Line 1557: this._connection = new global::System.Data.SqlClient.SqlConnection();
    Line 1558: this._connection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["authorConnectionString"].ConnectionString;
    Line 1559: }
    Line 1560:


    Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\4a768cc8\13ff178f\App_Code.jx63sdzn.0.cs Line: 1558
     
  5. What is your web application doing when you get this error? These errors can be caused by a lot of different things. Typically when I setup a new application and I didn't load or create the tables or objects on the database I can get this error when I run my app. Make sure you either restored your database to our server correctly or you created all the required objects on your database.
     
  6. I had this database placed on SQL2005 connected and queried it for 3 months without ever having a single problem it performed as expected then I decided to upgrade to SQL2008. Thats when all my problems surfaced. I followed all the KB instructions, in my web. config file I changed the connectionstring from the old web.config to point to the new SQL2008 server parameters. I did notice that compared to my old SQL2005 server panel it showed a 1% use. Now with SQL2008 it shows 0% use.

    I imagine my data files never uploads to the DASP SQL 2008 server with the panel database attachment tool although the attachment tools says it has completed its task. I have never changed database in any way it sits intact as the restored version .bak .

    So short of completely cleaning my database to default I would not know what I'm doing that is causing error on database query.
     
  7. Check your SQL 2008 database again. Go to Microsoft's web site and download SQL Server Managment Studio 2008 and connect to our SQL 2008 server. Make sure that all the required table, objects, and data are uploaded to your SQL 2008 database. If you do not see anything there, try uploading the SQL 2005 .mdf file to your SQL 2008 addon again. Remember to use the SQL Management Tool in your control panel.
     
  8. raymondp; I'll try and do as you said.

    But why would I need SQL server management studio to do this when VWD 2008 would essentially do the same thing? With VWD 2008 I see all my objects, tables etc.

    The techs at DASP told me my account does have the mdf dataset properly loaded on the SQL 2008 server account.

    <connectionStrings>
    <clear />
    <remove name="LocalSqLServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=tcp:sqlxxxx.discountasp.net;Initial Catalog=SQL2008xxxxx;User ID=SQL2008xxxxx_user;Password=xxxx" providerName="System.Data.SqlClient"/>
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer" connectionString="Data Source=tcp:sqlxxxx.discountasp.net;Integrated Security=false;Initial Catalog=author.mdf;User ID=SQL2008xxxx_user;Password=xxxxxx" providerName="System.Data.SqlClient"/>
    </connectionStrings>

    I still get error:

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

    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 1556: private void InitConnection() {
    Line 1557: this._connection = new global::System.Data.SqlClient.SqlConnection();
    Line 1558: this._connection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["authorConnectionString"].ConnectionString;
    Line 1559: }
    Line 1560:


    Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\4a768cc8\13ff178f\App_Code.jx63sdzn.0.cs Line: 1558
     
  9. This line on your web.config file kinda concerns me..

    <add name="LocalSqlServer" connectionString="Data Source=tcp:sqlxxxx.discountasp.net;Integrated Security=false;Initial Catalog=author.mdf;User ID=SQL2008xxxx_user;Password=xxxxxx" providerName="System.Data.SqlClient"/>


    You got the it to look for a database called 'author.mdf' which is the .mdf file. You cannot connect directly to a .mdf file you need to upload this mdf file to our server. I'm assumming you already have the SQL 2008 addon. Go to your control panel and in MS SQL 2008 you should see a tool that reads 'SQL Tool Suite'. Use that to upload your author.mdf file to our server. Use VS 2008 to connect to our SQL server and expand the table node and make sure that all the table and data was uploaded to our SQL server. If you do not see and tables or data then two thigs happened. One is that the author.mdf file is empty. You should check your application again. If you both the application from a vendor contact them and let them know the .mdf file they provided is empty. The second possibility is that the restore or attach procedure you used on the 'SQL Tool Suite' did not run correctly. Make sure you didn't receive any error message when you used this tool in the Control panel. You will then need to change the code on your web.config file. You will then need to change the catalog parameter to the database name we gave you when you ordered the SQL 2008 addon.
     
  10. So I configured my 2008VWD to connect to my dasp sql 2008 server account. I think I see "author" table same as my local . See mdf attach tool report.

    *see attachments pics

    still get the same error...


    (Don't have a vendor who prepared my database did it myself. I think my mdf file exists on dasp sql 2008 server so I'm not connecting w/web.config.)

    How you suggest I do this???
     

    Attached Files:

  11. what do you have setup for your connection string. if your web application is going to use our SQL server, you will need to setup the connection string to point directly to it.
     
  12. THis is the present settings for my connection string:

    <connectionStrings>
    <clear />
    <remove name="LocalSqLServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=tcp:sqlxxx.discountasp.net;Initial Catalog=SQL2008_xxxx_xxx;User ID=SQL2008_xxxx_xxx_user;Password=xxx" providerName="System.Data.SqlClient"/>
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer" connectionString="Data Source=tcp:sqlxxx.discountasp.net;Integrated Security=false;Initial Catalog=author.mdf;User ID=SQL2008_xxxxxx_xxxxx_user;Password=xxxx" providerName="System.Data.SqlClient"/>
    </connectionStrings>

    The green part of my connectionstring should point to my local with WAT web application tool.

    the black part of my connectionstring should point to my database (author.mdf) because the dasp SQL 2008 server says it's there so either I'm goofy or some machine or someone is not telling me the truth:confused:

    'cause it should work...

    My idea is I should erase my present DASP SQL2008 server account and start again and load data onto a fresh DASP SQL2008 server account.
     
  13. I believe your application is looking for a connection string named "authorConnectionString". You should add one with that name also.

    Code:
    <add name="authorConnectionString"
      connectionString="Data Source=tcp:sqlxxx.discountasp.net;Initial Catalog=SQL2008_xxxx_xxx;User ID=SQL2008_xxxx_xxx_user;Password=xxx"
      providerName="System.Data.SqlClient" />
    
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page