MBM Project migration 2017

by mbm - 2017/01/05 17:46

Today 5 January 2017 MBM Project starts migration to purposely build web site & blog platform based on MS ASP .NET & C# . Some of the old pages with obsolete information will be dropped. Some will be kept for reference. During the migration due to different platforms the information in the old articles might be partially lost or with changed formatting. Users' comments will not be transferred to the new site.

Smart 3D, MS SQL, Smart Marine, MBM Project, MBM Project

List registered SQL servers using C#

by mbm - 2011/10/16 21:35

Applicable to: Smart Marine 3D, Smart Plant 3D using SQL 2005 client

Smart Plant/Marine 3D software require the SQL servers where projects/plants database is located to be registered on each client workstation. In the software version up to 9.1 HotFix: ANY it is required to have also SQL 2005 client installed on the workstation.

Writing an external add-on software that need to access SQL database (relax - access it read only, creating some kind of reports for example) it would be useful to get a list of registered servers available to the particular client where the software will be used.

An easy way is to use Microsoft.SqlServer.Management.Smo namespace. Example code follows.

Unknown Object

using Microsoft.SqlServer.Management;using Microsoft.SqlServer.Management.Smo;using Microsoft.SqlServer.Management.Smo.RegisteredServers;private void Form1_Load(object sender, EventArgs e)        {            RegisteredServer[] rsvrs = SqlServerRegistrations.EnumRegisteredServers();            String localserver = System.Environment.MachineName;            foreach (RegisteredServer rs in rsvrs)            {                string svrname = rs.ServerInstance.Replace(".", localserver)                                                   .Replace("(local)", localserver)                                                   .Replace("localhost", localserver);// Add SQL servers name to checked list box controlif (cklbServers.CheckedItems.Contains(svrname) == false)                    cklbServers.Items.Add(svrname, CheckState.Unchecked);            }        }

To work the above code needs the following DLL to be registered in the C# project

Location: C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies

C# project references

[caption id="attachment_142" align="alignnone" width="300" caption="C# project References for enumerating registered SQL servers"][/caption]

Smart Marine 3D beginners SQL quick start

by mbm - 2011/10/16 21:35

Some simple SQL queries that can help new users start faster.

Applicable to: SmartPlant 3D , SmartMarine 3D and Smart 3D design systems.

Create equipment list including equimpment description. The information is stored in two different tables in projects' (plants' ) database - XXXX_MDB. The table view JNamedItem contain all items names and their IDs - oid. The equipment data is read from JEquipment. Table view JEquipment has information for the equipment ID but not for its name. Read ItemName from JNamedItem and match the object IDs 'oid' from both tables views.

Example SQL query:

SELECT ItemName, Description


JEquipment eqp,

JNamedItem nam



Order by 


See also how to create SQL filter for use in SM3D (SP3D) work space. The filter lists all objects created or modified during the last few hours.

Smart 3D, MS SQL, Smart Marine, SP3D, Smart Plant

SmartMarine 3D - Show recent objects in the work space

by mbm - 2013/12/09 14:48

Database platform: MS SQL server Product: SmartMarine 3D, SmartPlant 3D (SM3D, SP3D) Task: Show in the work space all objects created or edited recently For troubleshooting and for monitoring purposes it is useful sometimes not only to get a list of the objects created or edited recently, but also to show these objects in the work space.
To get the recently edited or created objects using SQL query, create in SM3D (SP3D) SQL based filter and key in the following

select oid from JDObject where datecreated > DATEADD(hour, -5, getdate()) or datelastmodified > DATEADD(hour, -5, getdate())

The SQL filter from the example will show all objects created or edited during the last two hours if the PC clock is using timezone GMT+3. SmartMarine 3D SQL filter workspace