attach DB?

Topics: ViNull Siding Forum
Jan 15, 2007 at 12:55 PM
hi
how can i attach the DB of vinull? to sql server 2000? there is only one .mdf file and no .ldf file.
i have tried attaching through stored procedure like

EXEC spdetachdb @dbname = 'vinull'
EXEC spattachsinglefiledb @dbname = 'vinull',
@physname = 'C:\Inetpub\wwwroot\Viblog\App_Data\vinull.mdf'

but it gives error

Server: Msg 602, Level 21, State 50, Line 1
Could not find row in sysindexes for database ID 14, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.

Connection Broken

please help
thanks
Coordinator
Jan 15, 2007 at 6:23 PM
The database was created inside of VWD Express, using the tools it provides. I believe this is a version of SQL 2005 Express. The web.config will point to the file, there is no need to attach the database to an instance of SQL server. If you did want to attach it however, I don't think it will work on SQL 2000.

Please let me know if this helps,
Mike
Jan 16, 2007 at 7:50 AM
thanks for reply, but i didnt' worked for me.
i dont have sql express installed. my default connection string in Connectionstrings.config file is

<add name="ViNullDB" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ViNull.mdf;Integrated Security=True;User Instance=True" />

and my vinull's path is
c:\inetpub\wwwroot\viblog\App_Data\vinull.mdf

plz tell me what should be the correct connection string. thanks in advance
regards
Coordinator
Jan 16, 2007 at 12:50 PM
Are you using Web Developer Express 2005 or Visual Studio 2005? I've not tested this in earlier versions. SQL Express 2005 is a free download from Microsoft.com http://msdn.microsoft.com/vstudio/express/sql/

From within VS 2005 / Web 2005 you should be able to open the folder by using "open web site" then click "start" (green play button) to run the site with the embedded web server. I am not sure, but installing SQL Express 2005 might be required for Web Developer Express 2005 to load a database.

From withing Web Developer Express are you able to double click on the MDF and view the tables and data?
Jan 17, 2007 at 1:10 PM
i am using visual studio 2005 with sql server 2000.
is it possible that you can post script of database so that any one who is not using express edition can use that script to create database on sql server 2000 or 2005.
thanks


Coordinator
Jan 17, 2007 at 2:47 PM
I'll create a script and upload it to the project. Since the database is SQL 2005, it may not work in 2000. VS 2005 should have come with a developer edition of SQL 2005 you can use if you don't want to install express. I'm under the impression that an SQL server install is not required to use the database with the VS Web Server though, and the following should work on your system:

. Unzip the download
. go to the ViNullDemo folder and check that AppData/ViNull.mdf is not set to read only (right click -> properties).
. Open VS 2005
. Double click the App_Data/ViNull.mdf
. You should be sent to the Server Explorer, expand the tables folder to test the connection
. Run Debug -> Start Debugging and select the radio "run without debugging"

If you get an error with the above, can you post the error message? (I'm still going to upload the script I just want to make the above work).

Thanks!
Mike
Coordinator
Jan 18, 2007 at 2:54 AM
I've created an sql script and put it up on the release page. It will need work to run on 2000, I tried to export it for 2000 and got an error that some field types were not supported (using Microsoft SQL Server Database Publishing Wizard 1.0).

Mike
Jan 19, 2007 at 11:13 AM
hi
i have followed the steps you have told. but its not working at all. i have downloaded the script and tried it in query analyzer but it gives way too much errors.
also i tried the seconed thing you mentioned opening mdf file in VS2005, but its open as in VS2005 as its a hex file. no errors whatsoever.
regards
Coordinator
Jan 19, 2007 at 2:07 PM
I'm sorry you are having this much trouble getting this working - I don't have a "clean" system to test this out on, and that probably is contributing to the mess :/

There is a blog post about using the SQL script I generated: http://weblogs.asp.net/scottgu/archive/2007/01/11/tip-trick-how-to-upload-a-sql-file-to-a-hoster-and-execute-it-to-deploy-a-sql-database.aspx

I'm assuming though you still don't have any SQL 2005 installed? Is there a reason you don't want to install 2005 Express?
Jan 20, 2007 at 10:09 AM
i have mentioned in my post above that i am using sql server 2000. i cant install sql server express coz i have to uninstall sql server 2000 for that which i cant do coz of my current asp.net applications running on it.
i will try the link you have given and will share my exprience.
regards and sorry for disturbing you again n again n again
Coordinator
Jan 20, 2007 at 12:22 PM
Okay, I had had thought the 2000 and 2005 could run side by side - I just learned they can't. The script will need some changes to load in 2000, I think I used field types that don't exist in 2000. I've only ever used 2005 (my background is Oracle and MySQL) so I may not be able to help much in converting the script.