Archive for August, 2010

寧靜的星期六

幫仔仔去city 買notebook 比想像中快

唔洗排隊既~~

想當年我係科大買排左成個鐘呀….

傻瓜快D放工搵我喇 , 好掛住你呀~

No Comments

Upgrading WSS 3.0 to Windows Sharepoint Foundation 2010

I have used the most simple approach to perform this task.

The main idea is to setup another machine in Windows Server 2008 R2 (64 bits) with MS SQL Server 2010 Express installed, then migrated the Content DB from the old machine to the new machine.

Details are as follows,

1. Install Windows Server 2008 R2 (64 bits), .net framework 4 and MS SQL Server 2010 Express in the new machine

2. Install MS SQL Management Studio Express in the old machine, which is needed for backup the old content database.

3. Backup the old content database by following steps,

( my old WSS 3.0 is installed to the Windows Internal Database, therefore, we can connect Connect to this database using “\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query” as the database instance)

Right click the WSS 3.0 content database, such as “WSS_Content”, choose “Tasks” and then “Backup”. Following the steps in the screen to backup to a physical file.

4. Copy the backup file to the new server

5. Login SQL Management Studio in the new server, right click “Database”, and choose “Restore”

6. After restoring the database, we may install MS SharePoint Foundation 2010.

7. After running configuration wizard, the management console is shown. Create a web application first.

8. Actually the web application is empty. We perform following steps to attach the restored DB as the content database.

To attach a content database to a Web application by using Windows PowerShell
Verify that you meet the following minimum requirements: See Add-SPShellAdmin.
On the Start menu, click All Programs.
Click Microsoft SharePoint 2010 Products.
Click SharePoint 2010 Management Shell.
At the Windows PowerShell command prompt, type the following command:
Mount-SPContentDatabase -Name <DatabaseName> -DatabaseServer <ServerName> -WebApplication <URL> [-Updateuserexperience]

To attach a content database to a Web application by using Windows PowerShell

On the Start menu, click All Programs.

Click Microsoft SharePoint 2010 Products.

Click SharePoint 2010 Management Shell. [Run as Administrator here!!!]

At the Windows PowerShell command prompt, type the following command:

Mount-SPContentDatabase -Name <DatabaseName> -DatabaseServer <ServerName> -WebApplication <URL> [-Updateuserexperience]

9. Done!

Ref: http://technet.microsoft.com/en-us/library/cc287634.aspx

In case the user experience is not updated

Solution:

In short, add it to the library.  To do this:

1. Go to the upgraded 2010 site, and make a subsite

2. Download a copy of the v4.master page. (Site Settings, Galleries, Master Pages)

3. Go to the upper level (or any site where the error is) and upload the copy of the v4.master into the master page gallery. (Site Settings, Galleries, Master Pages)

4. Try the visual upgrade again.

Ref: http://geekswithblogs.net/SharePointCherie/archive/2010/08/05/visual-upgrade-failed.-the-default-master-page-for-this-user.aspx

http://technet.microsoft.com/en-us/library/ff607998.aspx

No Comments

Excel automation Workbooks. Open error 0x800A03EC on Server 2008

I resolved this issue with the following steps

1. Login to the server as an administrator.
2. Go to “Start” -> “Run” and enter “taskmgr”
3. Go to the process tab in task manager and check “Show Processes from all users”
4. If there are any “Excel.exe” entries on the list, right click on the entry and select “End Process”
5. Close task manager.
6. Go to “Start” -> “Run” and enter “services.msc”
7. Stop the service automating Excel if it is running.
8. Go to “Start” -> “Run” and enter “dcomcnfg”
9. This will bring up the component services window, expand out “Console Root” -> “Computers” -> “DCOM Config”
10. Find “Microsoft Excel Application” in the list of components.
11. Right click on the entry and select “Properties”
12. Go to the “Identity” tab on the properties dialog.
13. Select “The interactive user.”
14. Click the “OK” button.
15. Switch to the services console
16. Start the service automating Excel
17. Test you application again.

1 Comment

.NET 4.0 cannot find assembly reference even though assembly is there and there are no exclamation marks on the reference in Visual Studio 2010.

Simply change the Target Framework drop down to .NET Framework 4 instead of .NET Framework 4 Client Profile and your code should compile.

No Comments

My Development Platform(s)

devTools

No Comments

Data Replication using MS SQL Server

Consumer Point of Sale (POS) Applications

http://msdn.microsoft.com/en-us/library/ms151330.aspx

How to: Create a Publication and Define Articles (SQL Server Management Studio)

http://msdn.microsoft.com/en-us/library/ms151160.aspx

SQL Server 2008 R2 Replication

http://msdn.microsoft.com/en-us/library/ms151198.aspx

No Comments

Calling Excel Object Model using .net

1. Add Reference to Visual Studio by righ clicking the “Reference” folder in the project, click “Add Reference” and choose “Microsoft Excel 11.0 Object Library” in COM tab

2. do the coding like the following example,

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Excel = Microsoft.Office.Interop.Excel;
using System.Reflection; 
				

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Excel.Application excel = new Excel.Application();
            Excel._Workbook wBook = excel.Workbooks.Open(@"C:\Users\allenk\Documents\Visual Studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\Sample_V1.1.xls");
            Excel._Worksheet wSheet = (Excel._Worksheet)wBook.Worksheets["Data"];
            
            // cleare data worksheet
            // cannot use this as this will remove the reference of pivot table
            wSheet.Columns["A:F"].Clear();
            wSheet.Cells[1, 1].Value = "Location";
            wSheet.Cells[1, 2].Value = "Year";
            wSheet.Cells[1, 3].Value = "Season";
            wSheet.Cells[1, 4].Value = "Division";
            wSheet.Cells[1, 5].Value = "Rec Qty";
            wSheet.Cells[1, 6].Value = "Ord Qty";

            // fill in data here
            for(int i=2;i<=100;i++)
            {
                wSheet.Cells[i, 1].Value = "Test";
                wSheet.Cells[i, 2].Value = "2010";
                wSheet.Cells[i, 3].Value = "08";
                wSheet.Cells[i, 4].Value = "Test";
                wSheet.Cells[i, 5].Value = 70;
                wSheet.Cells[i, 6].Value = 100;

            }

            // Refresh Pivot Table
            wBook.RefreshAll();
            
            // Save the workbook after editing the data
            wBook.Save();
            wBook.Close();
            excel.Quit();
        }
    }
}

No Comments