Case study using MUST+Web: Upsizing and converting the
Northwind database to Microsoft® SQL Server using Visual
Studio
Pre-requisites
Upsizing the database
To run MUST you will require a copy of Microsoft Access, any version from Access 2000 to Access 2007 can
be used. You will also require Microsoft® SQL Server (2005, 2008 or the Express addition).
Converting the Access database to utilise .net
You will require a suitable tool for creating and editing web sites using .net; we would recommend either
Microsoft Visual Web Developer 2008 Express Edition (FREE) or Microsoft Visual Studio 2005/2008
Editions.
• Microsoft .NET is software for connecting people, information, systems, and devices.
Converting reports to report server
If converting reports you will require either SQL Express Advanced Edition (with report services) or SQL
Server 2008/2005 with report services installed. You will need to start and configure report services before
it can be used (see later in this document). You will also require either Visual Studio with the ability to
create a Report Server Project or SQL Server Business Intelligence Development Studio (FREE with SQL
Express Versions and included in all other versions of SQL Server).
Check list before starting

You have extracted all the files supplied with MUST+Web into a single folder.

You have a copy of Microsoft Access on the machine.

You have the Northwind database provided in the download package
NW_ForMUSTWebTrial.mdb or NW_ForMUSTWebTrial.accdb.

You have a copy of Visual Studio or Visual Web Developer (FREE).

You have a copy of SQL Server (2005, 2008 or Express edition) installed with Report Services (if
required).
NOTE if you are using the demonstration version of MUST+Web then it is hard-coded to only convert
Northwind. You can also use the trial version of MUST+SQL which will enable you to upsize your own
database to SQL Server and see examples of SQL Conversion but will not perform the Web conversion
operations.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Introduction
This case study shows how you can perform an end-end conversion of the classic Microsoft Northwind
database.
The conversion will start by upsizing the Access data tables to SQL Server, and then re-linking the Access
application to the SQL Server tables.
Conversion then proceeds by converting all the Access Queries to Views/Stored Procedures, and then
identifying and packaging all the SQL used on Form/Report record sources (includes controls such as
combo boxes) into Views. The Access application is then re-linked with all queries and form/report
RecordSources using the new views.
The conversion will then generate a web site with web forms to replace your Access forms, and reporting
forms which will link to a Report Server.
The process is completed when you import your Access reports into a Report Server Visual Studio Project,
re-link the reports and then publish the reports to a report server.
Upsizing the Northwind database
1. Creating a SQL Server database
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
2. Selecting the Access Database
3. Analysing the Access Database
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
4. Migrating the Access Database Structure
5. Migrating the Access database data, indexing and relationships
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
6. Verify Row Counts
7. Re-link the Access Database to SQL Server
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Migrating the queries and re-packaging form/report RecordSource SQL for .net
conversion
1. Analyse Queries, Forms and Reports: If you
all of your forms and reports to .NET, then you
following selection. If you are not going to
and reports then DO NOT make this selection.
intended to migrate
must make the
migrate the forms
2. Choose all queries and build all the queries
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
3. Make any corrections to critical queries which have errors, and build those queries (in this case 1
change is required)
To make the required change, View the SQL on the query which has a conversion error, then edit the SQL
changing DATEPART(q,[Orderdate]) to CONVERT(VARCHAR(DATEPART(q,[Orderdate))) this occurs in two
places, then Save Changes To SQL and press the Build All Selected Queries button to re-build this query. If
you are unable to complete this then proceed through the case study as this will have a minimum impact
on the conversion.
4. Replace all the queries in the access database, re-point all forms and reports at views; steps 1, 2, 3
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Building the web site
1. Check Data and Structure. The Data Dictionary must be loaded and the Access Database re-linked
in order to proceed.
2. Check SQL Conversion. This area will tell you if the Access SQL migration has been completed,
Queries, Forms and Reports have been successfully analysed and linked. If all boxes are green,
proceed.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
-
Using Visual Studio Professional or Visual Web Developer, you now create an empty web site.
Start Visual Studio and create an empty web site.
Note when using Vista, you should create your web site in your personal web folder (this will be the default
setting) as MUST requires to copy files to the web folder and this may not be allowed in certain versions of
Vista.
Alternative Menus when using Visual Web Developer
Select to build a new web site.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
3. Check that you have all the required MUST files
4. Check the options that you wish to use in generating the site.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
At this stage you do not have to create the Report Server but it will help if you can specify the server and
folder name. If you are not ready yet to delve into report services then this can be skipped.
You must set the correct path for the web site: If you are building a website on the internet, then
uncheck the “Windows Authentication”. MUST will then build you integrated security routines to use
SQL Server Logins. If you are going to run the system on an intranet with Windows Authentication then
check this box.
5. Prepare Site.
After you have prepared your web site, all of the boxes should be green.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
6. Choose Forms, excluding forms, setting page sizes and captions
This page can be left with the default settings.
7. Choose Fields.
In order that you can search and filter web pages, MUST will automatically build a search box. In this
screen you specify the search fields for each form. Adding one or two search fields will be useful to
illustrate how this works.
For example
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Search Filter:
Checking this box adds a search field.
Range From To:
This creates a ‘from and to range’ for date fields or numeric’s.
Like another Control:
This allows you to associate the search field with an existing drop-down list. For example sometimes the
Country field in this case is a text box, but by using the SelectCountry drop-down a drop-down list can be
used.
8. Choose Reports. Review Reports and exclude any which are not required.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
9. Build Site
You will need to refresh the site to see the new files either using the main menus or the solution explorer
window.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Editing web.config
You will need to edit the connection string in this file, providing the name of your server/instance and
database.
Executing and testing pages
From inside Visual Studio, you can execute pages by opening a page in the editor and pressing start
debugging icon to test individual pages.
10. Security for Internet Applications
If you receive the following dialog, then it is to remind you that because you are not using Windows
Authentication, you need to set the password and account to be used by the ASP processor.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
In the above example the SQL Server has been configured to allow for SQL Server Logins.
The appropriate account has been created and assigned the password.
To make security simple in this case the account has been assigned sysadmin security.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
When a user first opens the site they will be presented with a login page, that they can enter a user name
and password. If it is a new username then the MUST security routines will create a SQL Server Login and
enrol them in the Read-only database role in your database.
The MUST security routines are only intended to get you started using a site.
The above example would create a SQL Server login called “testuser” and assign them to the Read-only
role in your database.
11. Creating the Database Security Roles
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
This is only essential if you are not going to use Windows Authentication.
Pressing the button will create a database role in your database, which has read-only permissions on the
[dbo] schema (where most of your tables will be placed), and creates Read\Write permissions on the
Reporting Schema. The reason for this is as follows.
When a user selects to search for information, a search box is displayed.
You can see above how the search data is specific to our “testuser” login. When the user presses the
search button; the search choices are saved to the search/filter and reporting table
Reporting.tblParameters_M.
User search parameters are read and written using the view shown below.
Because of this MUST implements a true multi-user reporting and searching methodology.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Read-only user additional permissions
If you have read-only users, then you also require to grant the read-only database role explicit permissions
to update the synonym vw_tblParameters; this is required for saving users filter choices. See below.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Appendix A: Converting reports to run with Report Server
MUST will not automatically convert your reports, instead it create a page which uses the report viewer
control to display your report. An Example is shown below.
You need to create a report server project and then publish the reports to report server.
Configuring Report Server
Report server must firstly be configured.
First start the report server configuration tool.
Follow the instructions on each step until you have a green light on all the necessary buttons.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
As part of this process, a web site will be generated for report server. The name is different for Express and
the Full SQL Server product.
For express this will be http://machinenameReportServer$SQLExpress
Creating a Report Server Project
Start by opening Visual Studio and selecting to create a new Project (not a web site).
If you are not using Visual Studio, but using Visual Web Developer then you will need to use the SQL
Server Business Intelligence Development Studio, which comes with SQL Server and SQL Express.
Make the project selections as shown below.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
The select the project properties and enter your report server URL.
http://dev2005/ReportServer$SQLExpress
When getting started it is a good idea to prepare a very simple copy of your access database containing
one simple report, after which you can be more ambitious and import multiple reports.
When importing Access reports, ALL THE REPORTS in the access database get imported, and compilation
errors will prevent you deploying the reports to report server.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Using visual studio, import the Access reports.
In this case we need to remove a control from the imported report.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Now the report can be previewed as shown below.
WARNING: YOU CANNOT DEPLOY THIS REPORT, IT WILL NOT WORK CORRECTLY BECAUSE IT USES OLEDB
AND THIS IS NOT SUPPORTED BY REPORT SERVER. DO NOT BE FOOLED BY THE PREVIEW!
To make the report work will Report Server, we are going to need to create an alternative Data source.
Proceed as follows.
From the Data page, select a new data source.
Select the build button shown below.
Next either paste in your connection string or use the edit button to create a connection to your database.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Pressing OK twice returns you to an empty grid.
If working on several reports, we would recommend using the clipboard contents to go through the
reports and create all the new DataSources, and then return to the following step.
Return to the first dataset and copy the SQL to the clipboard.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Paste the results into the new DataSource and execute the query.
Now delete the old dataset.
You can now save and preview the report.
Once all reports have been changed you can ‘Build and Deploy’ the project.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
You should now be able to return to the web page created by MUST and preview the report.
Managing Security in Report Server
The easiest way to do with Windows Authentication is to ensure that all your users are part of a Window
Group; say for example ReportUsers.
Then browse to the Report server Manager location, and add in this Group with browse security
permissions on the server.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Appendix B: Master Pages
MUST generates web-forms that use Master Pages. The Master page defines content areas, where the web
forms will fill in content.
Previewing the master page looks a bit messy.
And it is preferable to look directly at the mark-up.
Content areas are placed within a DIV tag and assigned a CSS class in the following case called “cphmenu”.
<div class = "cphmenu">
<asp:contentplaceholder id="cphMain" runat="server">
Target Page Missing
</asp:contentplaceholder>
</div>
In the systems CSS file you will find the screen position information and colours etc that control each
content area.
Appendix C: Site Navigation
In the sites master page, you will find a content area which controls the menus.
<div class = "leftsidemenu">
<asp:contentplaceholder id="cphleftsidemenu" runat="server">
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
<asp:Menu ID="DropDownTree" runat ="server" DataSourceID="SiteTreeMenu" cssClass = "Tree"
orientation ="Horizontal"
StaticEnableDefaultPopOutImage = "false"
StaticDisplayLevels = "1"
>
<StaticMenuStyle CssClass ="PrimaryStaticMenu" />
<StaticMenuItemStyle CssClass = "primaryStaticMenuItem" />
<DynamicMenuStyle CssClass ="PrimaryDynamicMenu" />
<DynamicMenuItemStyle CssClass = "primaryDynamicMenuItem" />
<StaticHoverStyle CssClass ="primaryStaticHover" />
<DynamicHoverStyle CssClass = "primaryDynamicHover" />
</asp:Menu>
<asp:SiteMapDataSource ID="SiteTreeMenu" runat="server"
ShowStartingNode="true" />
</asp:contentplaceholder>
</div>
The detailed menu options are contained in the web.sitemap file.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Appendix D: Problems with Dropdown lists and Selected Values
'cboBookingID' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
The above error means that a data value in a bound field does not have a corresponding entry in the
dropdown list being used to display the values.
Possible solutions are:

Avoid using a dropdown list.
Ensure all data is available in dropdown lists; possibly run an update to set to NULL any data fields
which is no longer available in the drop-down list.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Appendix E: Problems with data binding and field names
MUST utilises the standard two-way binding provided by .net to move data between the form and the
database.
For example on a control inside a template you could see an expression like the following:Text='<%# Bind("Currency") %>'
If however, the field name contains spaces of any special symbols then [ ] must be used to surround the
field name, as a result of this updates and inserts fail and the binding becomes a one-way binding
displaying data.
Text='<%# Bind("[Currency Values]") %>'
MUST will generate the [ ] and mark the field as read-only, when it finds any of the following symbols in a
field name including any spaces + - ; : ? &
It is possible, and not recommended to have the same field name selected twice in a query (which forces
Access to use a dot in the field name); such as Orders.OrderId. MUST will automatically exclude the fields
(see reporting for a list of fields).
The following will not work:Text='<%# Bind("[Orders.OrderId]") %>'
Visual Studio will compile this, but it will NOT WORK.
The use of an ‘&’ such as [R&DCompany]; whilst this will result in data which can be displayed, the data can
not be edited. MUST automatically makes these fields read-only.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Appendix F: Problems with data types
Access memo fields:
Access memo fields have been traditionally translated into SQL Server TEXT data types. However, TEXT
data types have always been problematic in SQL Server, and with the introduction of SQL Server 2005 we
now have a new VARCHAR(MAX) field which is a better choice that TEXT data types (unless you use an
Access front-end in which case TEXT is a better choice, but for .net TEXT does not work, thus
VARCHAR(MAX) is the choice to make.
Timestamps:
Whilst Microsoft recommends the use of timestamps, bound Visual Studio controls do not work with this
data type. So MUST uses row versioning with an optimistic write-back to resolve multi-user conflicts.
Appendix G: Problems with UK dates
Visual Studio has problems with UK date formats and bound controls, this can be avoided using the
formatting “{0:dd/MM/yyyy}”. However, once you take control of the SQL used for writing updates even
deeper problems come to light.
The problem is that whilst you use a formatting string {0:dd/MM/yyyy} and declare a parameter such as
@orderdate type DateTime. VS does not do a conversion back to ANSI US date format; thus update and
insert and delete commands fail. MUST automatically inserts CONVERT(DATETIME,@OrderDate,103) in the SQL and
declares String type parameters for @OrderDate; which allows UK dates to be correctly handled.
Features
Field names
1. Illegal field names are automatically excluded.
2. Problem field names are automatically rendered as read-only controls.
Grid Layout Editing
Fields which are locked or not enabled or set read-only are displayed as labels.
Detail View Editing
Fields which are locked or not enabled or set read-only are not displayed.
Locking
Automatic generation of optimistic locking update code and handling null value’s in controls.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Appendix G : Common Problems
Why when I display a web form does it show no data when I would expect to see some data?
The most likely reason for this is that the view supporting the form requires a selection to be made in
criteria before any records can be displayed. Use the search box to make appropriate selections.
Alternatively examine the SQL being used to display the data.
How can I clear the search/filter criteria?
At the moment each individual search and filter field must be cleared individually to change selections.
Why when I browse to the site using IE, does it not appear to work?
Use IIS to check that you have created the virtual directory.
Why when I browse to the site using IE, does it not appear to be blank?
The Default.aspx file you created when the site was created is empty, you will either need to enter some
content in Default.aspx, or re-name one of your forms to Default.aspx (in Visual Studio). If you choose the
last option you will also need to change any references to the old name in the Web.Sitemap to refer now
to Default.asp.
How do I clear a selection in a dropdown list?
The first entry in drop-down lists is ‘none’, selecting this clears the selection, setting the database field
value to null.
Why is a field that should be available when inserting or editing records is not available, but is shown
when simply displaying a record?
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
The tool has decided to hide the field for one of the following possible reasons.
a) The database field name contains spaces or special characters which prevent the field being updated.
MUST+Web has reports which can highlight these issues.
b) The control type on the Access Form was marked as locked or had it’s enabled field property set to No,
or was a hidden field.
c) The field is an AutoNumber.
How could a search field be displayed twice, when I only selected it once?
Use the view unbound controls to see that MUST has not already automatically identified your field.
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved
Appendix H : More details on the web.config settings
You need a ConnectionString to connect to the database, enter your server name and database name (bold
text below):<connectionStrings>
<add name="appConnectionString" connectionString="Data Source=dev2005\sqlexpress;Initial
Catalog=NWNET;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
The next section contains details for the ReportViewer control, and is set to enable site debugging.
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler,
Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
validate="false" />
</httpHandlers>
<compilation debug="true" strict="false" explicit="true">
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
</compilation>
The next very small change ensures that your row position on lists of records is preserved when editing
data.
<pages
maintainScrollPositionOnPostBack ="true"
>
The last change switches on Windows Security, and tells the ASP.NET process that when communicating
with SQL Server it should use your Windows Authentication credentials.
<authentication mode="Windows"/>
<authorization>
<deny users="?"/>
</authorization>
<identity impersonate="true"/>
Add the following in the system.web section for UK currency and date formats
<system.web>
<globalization culture="en-GB" />
MUST+Web a case study
© ASC Associates 2008, All Rights Reserved