Dave's Technophorical Times

A blog about Microsoft's Technologies!
SharePoint :: MVC :: ASP.NET :: IIS :: SQL Server :: Visual Studio :: MS Access

It is a pain to set the default browser in Visual Studio UNLESS you use a brilliant tool like this.

WoVS Default Browser Switcher
http://visualstudiogallery.msdn.microsoft.com/bb424812-f742-41ef-974a-cdac607df921/



If you want to copy the contents of a Results window from inside Microsoft SQL Server Management Studio AND include the Column Headers then you need to set the following via Tools -> Options.

Query Results -> SQL Server -> Results To Grid -> Check the box next to "Include column headers when copying or saving the results".

Note that you will need to close your current session and open a new one before this change takes place.



This is how to list all tables in a SQL Server Database with one statement, or two.

--Tables by Rows Descending Order
SELECT sysobjects.Name,
       sysindexes.Rows
FROM   sysobjects
INNER JOIN sysindexes ON sysobjects.id = sysindexes.id
WHERE type = 'U' AND sysindexes.IndId < 2
ORDER BY sysindexes.Rows DESC

--Tables by Table Names
SELECT sysobjects.Name,
       sysindexes.Rows
FROM   sysobjects
INNER JOIN sysindexes ON sysobjects.id = sysindexes.id
WHERE type = 'U'AND sysindexes.IndId < 2
ORDER BY sysobjects.Name



Have you ever wanted to clear the list of Projects from the Start Page in Visual Studio? Here's how to do it.

Run --> RegEdit  and navigate to: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\<your version>\ProjectMRUList.

Delete the entries that you don't want.

You can also remove the recent list of files by clearing entries in the HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\<your version>\FileMRUList!

One more thing to mention. If you get those annoying Project names like Project (2), Project (3) and just want to start over then you can do that be deleting the folders in My Documents\Visual Studio 2008\Projects\. Usually these folders will only contain the Soluntion (*.sln) files.

Happy Programming!
Dave



Jan
11

About Me

by Dave Stuart | Tags:

Dave Stuart

Info about Me....The Blogger

So every blog needs this info...

I'm a Developer/BA with 15+ years in the IT industry. I have worked in the UK and Canada as an IT professional and have more years as a contractor than a full-time employee, which is just the way it has turned out. I currently reside in sunny, but frigid, Calgary and moved here from the UK in 2003.

My company Website is http://www.dafran.ca



Today I ran into more issue when working with deployment of my very first Web Part using Visual Studio 2008 on a 64bit Windows 2008 OS. One important tip when trying to deploy using a SharePoint WebPart for within Visual Studio as that you MUST add the VSeWSS user to the Sit Collections Administrators list. By default that will be just the Primary and Secondary admins of the Site Collection.

Note that you will probably only run into this issue if you have installed Visual Studio 2008 extensions for Windows SharePoint Services 3.0, v1.3 WITHOUT first creating the VSeWSS Application Pool. Please refer to the Release Notes as it will explain how to add the VSeWSS local user to all the required groups.

CAUTION: if you come across a post on the web that tells you to run this comment, then be VERY CAREFULL as it will knock-out your 64bit WSS SharePoint Web Applications if that's what you have: cscript %SystemDrive%\inetpub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 1. Only Enable 32-bit on the VSeWSS App Pool.

Hope you have as much fun as I did, but it is great when I was finally able to deploy from within Visual Studio. 



I was trying to run "aspnet_regiis -ga domain\user" from the command prompt today, but it wouldn't work! I was trying to add calsvdafran03\VSeWSS local user to IIS 7.0 on Windows 2008 Server so that I could take advantage of Visual Studio 2008 extensions for Windows SharePoint Services 3.0, v1.3. The 64 bit version that is. Anyway, I ran into difficulties running it and then discovered that I had to navigate to the C:\Windows\Microsoft.NET\Framework64\v2.0.50727 directory in order to successfully execute the command.

 



This is how to query an Oracle database for Table and Column information. Obviously, you can change these statements to work for what you need.

SELECT  TABLE_NAME
FROM USER_TABLES
ORDER BY TABLE_NAME;


SELECT U.TABLE_NAME,
           U.COLUMN_NAME,
           U.DATA_TYPE
FROM USER_TAB_COLUMNS U
WHERE U.TABLE_NAME = '<Table Name>'
ORDER BY U.COLUMN_ID;



I have recently wanted to create individual Content Databases for each new Site Collection that I add to a Web Application. This is excellent for keeping the content separate for backup and restore purposes. If you ever need to restore content then this is the best solution as you will just be restoring ONE Site Collection and not the entire Web Application.

Just as a precuror to this topic, this is what is stored in a Content Database.

  • All documents, news, links, contacts, calendars, and so on.
  • All Web Parts and their settings.
  • All customizations of sites done with SharePoint Designer.

So we are starting with a single Web Application with it's top level Site Collection. This is the Site Collection that is listed a "/" in the Site Collection List via Central Admin. My Top Level Content Database Name is WSS_Content. I now want to create a new Site Collection under /sites/ called sc1, so the first thing I do is create a new Content Database. Central Admin -> Application Management -> SharePoint Web Application Management -> Content databases. Then click on Add a Content database. Once in the next screen ensure that you have the correct Web Application selected, if not then change it now. The only thing you should change in this screen in the Database Name. I usually name the Database WSS_Content_[SiteCollectionName], replacing [SiteCollectionName] with whatever you want.

IMPORTANT STEP: Now put all OTHER Content databases OFFLINE.

Once that is done you will see that the Current Number of Sites is ZERO. Now all you have to do is create a New Site Collection via Central Admin -> Application Management -> SharePoint Site Management -> Create Site Collection for the Web Application you need and there you have it! The New Site Collection latches onto the vacant Content Database. You can double check that by going into the Site Collection List and selecting the new Site Collection that was just created.

COMMENTS: If you do not create a new Content Database first, then the New Site Collection will use the top level Content Database by default, which is fine if that's what you want. Give it a go!

Hope this Helps someone!
Dave Stuart



Have you ever wanted to move a subsite from a top level site into it's own Site Collection with it's very own Content Database? I have, and just recently I was able to do this with some help from other blogs, so here is how you do it in SIX simple steps.

STEP ONE: Export the subsite using the following stsadm command. Subsititue the url, filename and versions as required. This may create several files if there is a good amount of data.
stsadm -o export -url http://www.mytopsite.com/subsite -filename c:\subsite.cab -versions 4

STEP TWO: Create a new content database for your new site collection from Central Admin. Navigate to Central Admin -> Application Management -> SharePoint Web Application Management -> Content databases. Then click on Add a Content database. Once in the next screen ensure that you have the correct Web Appplication selected, if not then change it now. The only thing you should change in this screen in the Database Name. I usually name the Database WSS_Content_[SiteCollectionName], replacing [SiteCollectionName] with whatever you want.

STEP THREE: Put all content databases in Offline mode except for the one you want your new site to use. You do this via Central Admin -> Application Management -> SharePoint Web Application Management -> Content databases. Click on each Content database, change the Database status to Offline and click OK.

STEP FOUR: Create a new Site Collection via Central Admin -> Application Management -> SharePoint Site Management -> Create Site Collection. Make sure that the correct Web Application is selected, if not then change it now. Enter the Title, Description and the Site Collection name in the box after /sites/. Don't use any spaces. For this example I will use sc1. Also set the template to blank, but I don't think this matters. Finally, ensure a farm account is used for the secondary Admin of the new Site Collection.

STEP FIVE: Import the subsite exported earlier into the new Site Collection at the stsadm command using the following command.
stsadm -o import -url http://www.mytopsite.com/sites/sc1 -filename c:\subsite.cab 

STEP SIX: Go back into Central Admin and put all Content Databases back Online. Done! Well almost done. You should now go back to the Subsite that you just copied (http://www.mytopsite.com/subsite), ensure that the site does not inherit permission from it's parent, then remove all the security so that no-one can see it except for the Admins. Once you are happy with the new Site Collection (http://www.mytopsite.com/sites/sc1) it will be safe to delete the original Subsite. Finally, make sure you tell your users about the new URL to their new Site Collection.

COMMENTS: One thing that is not copied over is permissions, so you will have to redo these, however you now have a New Site Collection with it's own Content Database and Security!

I hope that someone finds this as useful as I did when I had to do the exact same thing just last week.

Thanks
Dave Stuart



The Blogger

Dave Stuart I'm a Developer with a passion for coding. I enjoy the challengers that come with the job! SharePoint is one of my expert areas along with .NET Web Development with MVC and good old MS Access VBA coding. I Blog so that I can remember how I did that way back when; PLUS all this stuff is searchable! I constantly study and run my own business, Dafran Inc. I have passed 22 Microsoft Exams since 1998 when I first jumped on the treadmill of knowledge. I hope that you enjoy this Blog as much as I enjoy updating it. All the very best from Calgary, Alberta, Canada. contact me at linkedin @ dafran.ca

Calendar

<<  November 2017  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

Sign in