View Full Version : Newbie question ref SQL Server 2005 Mgmt Studio Express
David Anderson 06-25-2008, 03:34 PM I am currently learning how to write web apps using ASP.Net 3.5 in association with a SQL Server 2005 Express database (everything is installed on the same PC). This database was upsized from Access 2003 and then copied into my ASP.Net project folder. I have no prior experience of using SQL Server - so I still have much to learn!
My current problem is that I would like to use SQL Server 2005 Management Studio Express to view and modify the MDF file copy used by ASP.Net but I have been unable to work out how to connect to this version of my database (connecting Mgmt Studio to the original MDF file is not a problem).
Any guidance would be much appreciated.
David
SQL_Hell 06-26-2008, 08:56 AM Heya,
Right click on 'databases' in management studio select 'attach' and then browse to your .MDF and .LDF files.
If this doesn't help then please provide more background information, such as what you have already tried and any error messages.
:)
David Anderson 06-26-2008, 01:10 PM Right click on 'databases' in management studio select 'attach' and then browse to your .MDF and .LDF files.
I've tried your suggestion but when I click Add to open up the Locate Database Files dialogue box and then try to browse to the C:\Documents and Settings\Administrator\My Documents folder (where my website files, including the mdf file, are located) the browser refuses to expand any further than C:\Documents and Settings\Administrator!
This is very strange behaviour. Can you suggest any way to force the browsing facility to work properly?
David
David Anderson 06-27-2008, 12:49 AM I've reinstalled SQL Server 2005 Management Studio Express (SSMSE) and rebooted my PC but the browsing restriction still applies. Under C:\Documents and Settings, I can drill down into the All Users folder and the Default User folder but it won't let me drill down into the folder for Administrator or any specific named user.
Outside SSMSE I have no known browsing or folder access issues. I am logged on as Administrator and should therefore have 'Full Control' security rights over every folder in the system. I'm at a loss at what to try next....
David
SQL_Hell 06-27-2008, 01:34 AM In management studio, click view / registered servers, in the registered servers box right click and go to properties, this should tell you what account you are using, make a note of this and post back.
Also try putting your .mdf file and .ldf into the route of C:\ and see if you can attach it from there
David Anderson 06-27-2008, 02:02 AM Hi,
Thanks for your assistance on this.
In the Registered Servers window I have two entries listed under 'Database Engine'. One is called dell-670 while the other is called dell-670\sqlexpress. The Properties box for each of these doesn't seem to tell me a great deal more (and there is no reference to anything called an 'account').
I am fairly confident that moving my mdf file to the root of the C: drive would make it visible to SSMSE but that would rather defeat the point of the exercise as ASP.Net currently expects to find it within the website folder structure.
David
SQL_Hell 06-27-2008, 03:09 AM Ok a few more things for you to try, try and attach the databases to each instance dell-670 and dell-670\sqlexpress and see if you get the same problem.
ASP.net shouldn't care where the database is, connection strings only care what the database name is and what the server name is, you dont really want to be putting your database within your web folder anyway it's not very good practice, imagine if you database grows to 10g then it would slow down your website being in the same folder.
I don't really know why you cant browse my documents through SSMSE its not very easy to say without actually seeing the problem, but it must a problem specific to your environment.
SQL_Hell 06-27-2008, 03:49 AM last post edited due to me talking rubbish :rolleyes:
David Anderson 06-27-2008, 04:32 AM I had already tried using each instance of SQL Server but both exhibited the same reluctance to drill down into My Documents.
As you suggested, I have now created a new connection string within ASP.Net to point to my original copy of the MDF file, which is located in the following folder,
C:\PROGRAM FILES\MICROSOFT SQL SERVER\MSSQL.2\MSSQL\DATA\
Both the ASP.Net connection and the SSMSE connection now work (though not at the same time). When I say ASP.Net what I actually mean is an ASP.Net website being created and tested with Microsoft Visual Web Developer 2008 Express Edition (Microsoft seems to love long product titles!).
Incidentally, the ASP.Net textbook I am using advises me to place my database files in the App_Data subfolder of the website as ASP.Net will automatically prevent direct user access to this folder when the site eventually goes live. It is therefore a little irritating to be forced to place the database elsewhere just to keep SSMSE happy. You would think that Microsoft would try to make its software mutually compatible....
Thanks for your help. I may not have the solution I really wanted but it is a solution I can live with.
David
SQL_Hell 06-27-2008, 07:31 AM ok glad I could help in some way :) Sorry if the solution isn't exactly ideal.
However whilst having some of my own SQL server 2005 woes today, I suddenly thought of something else you could try...
Have you service packed your management tools? if not SP2 is here....
http://www.microsoft.com/downloads/details.aspx?FamilyID=6053c6f8-82c8-479c-b25b-9aca13141c9e&displaylang=en
David Anderson 06-27-2008, 08:11 AM My version details for SSMSE are listed below. The service pack level is not mentioned (except for MDAC) but I only downloaded SSMSE a week or two ago (and re-downloaded & re-installed yesterday) so I am assuming that it already includes SP2 - given that the SP2 download is dated Feb 2007.
Microsoft SQL Server Management Studio Express 9.00.3042.00
Microsoft Data Access Components (MDAC) 2000.085.1117.00(xpsp_sp2_rtm.040803-2158)
Microsoft MSXML 2.6 3.0 4.0 5.0 6.0
Microsoft Internet Explorer 7.0.5730.11
Microsoft .NET Framework 2.0.50727.1433
Operating System 5.1.2600
|