Step 1 - Setting up the NexusDB server
For this example we are setting up the Datasource to get the data from a local NexusDB Server via TCP. For this purpose please start a NexusDB Server and activate the server by selecting the Activate all Modules item from the Server menu. Then please select the "Aliases" entry in the Database Settings tree branch and add an Alias ADOProviderSamples pointing to the ADO sample database (default: c:\Program Files\NexusDB1\ADOProvider\Data\).
Note: Some information in this chapter seem to refer to Version 1 of the ADO Provider only, e.g. the use of "NexusDBV1 engine", but in fact it is also valid for V2 of the ADO Provider.
The NexusDB Server is now running and ready to server us data for the ADOProviderSamples alias.
Step 2 - Creating a new WebMatrix project
Make sure the above software is installed properly on your system and then as a first step start Microsoft Web Matrix. After startup it will ask you what you want to do:
As default you'll find that Visual Basic is selected as Language. As we don't use any code for this article you don't have to change the Language, but if you want to extend it later, please select the desired language now. Please also click the Specify optional class information check box if you want to add a certain Class and Namespace. All these are optional for our sample application.
Make sure ASP.NET Page is selected in the templates folder and press OK.
This will present you with an empty page.
Step 3 - Adding and connecting the Datasource to the database
The next logical step is to create an instance of a Datasource on the current page. For this drag a nxDBDatasourceControl from the Toolbox and drop it on the (still) empty form. The newly added instance should be selected automatically and the Properties Inspector should look like this:
Unfortunately the IDE integration interfaces used by Microsoft Visual Studio 2003 don't work, and there's no documentation available how to integrate Wizards into Web Matrix. As a consequence, the Web Matrix support DLL for the NexusDB ADO.NET Provider does not include wizards to setup the ConnectionString and SelectCommand properties. So we need to set them manually.
For a list of valid ConnectionString parameters and detailed description please refer to the ADO.NET Provider Reference.
Using the information about the parameters we now construct the ConnectionString to be
Transport=TCP;Port=16000;Server=nexusdb@127.0.0.1;Database=ADOProviderSamples; Compression=9;BlockReadSize=512000;UserName=;PassWord=;
and set the property accordingly. For our small application we set the SelectCommand property to
select * from CD
Step 4 - Attaching the Web Controls to display data
We are now ready to set up the rest of our web page. Please drag a MxDataGrid control from the Web Controls tab of the Toolbox on the form. It should now look similar to this:
Select the MxDataGrid control and set the properties listed below to the correct value. Leave the other properties at their default values.
Property |
Value |
AllowPaging |
True |
DataSource |
nxDBDataSourceControl1 |
DataSourceControlID |
nxDBDataSourceControl1 |
DataKeyField |
DiskSerialNumber |
That's all there is to do.
Step 5 - Running the application
Press the Start button in the toolbar. Web Matrix will pop up a window to ask you how you want to run your application.
Usually we test run application with the ASP.NET Web Matrix Server as this generally rules out any non-application related issues, like user restrictions. You can also run it from an existing IIS server if you prefer to do so of course. Press Start to run the just created application which will look similar to this:
Congratulations. You've just built your first NexusDB application in Microsoft Web Matrix.