Database linkages

Hi i am trying to link graphical elements to the database using odbc connection.

Everything works fine in terms of text, but i need the level or colour of a specific element to go accross to the database and should change dynamically if i change a colour or level in the design.

Is this possible or not?

If so please explain

I am running microstation select series 2 on my pc

Parents
  • MDAC: Database Interfacing with VBA

    Read this article about MicroStation and databases. It mentions the Microsoft Data Access Components (MDAC), which are Microsoft COM libraries. Use MDAC to communicate between VBA and an external DB.

    Download MDAC and install on your computer. In VBA, make a reference to MDAC so you can use the library in your code.

    You will find plenty of information and examples of MDAC both in the documentation available from Microsoft and on the web.

    Database Content

    If you read the above article you will know that the DatabaseLink attached to an element is minimal. It matches the element with a row in a table using the MSLink (row ID) and Entity Number (table ID). If you want to store other information in the database then you must write the appropriate SQL statements, fill the parameters with the right values, and update your DB via MDAC.

    For example, the pseudo-code for adding an element's level to the DB would be something like this …

    1. Read an MSElement from a DGN model
    2. Check for a DatabaseLink
      • Match the Entity Number with your table ID (from MSCATALOG table)
      • Match the MSLink with a row in your table
    3. Get the element's level name
    4. Construct a SQL statement along the lines
      UPDATE <table> SET level='levelName' WHERE MSLINK=<mslink>

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

Reply
  • MDAC: Database Interfacing with VBA

    Read this article about MicroStation and databases. It mentions the Microsoft Data Access Components (MDAC), which are Microsoft COM libraries. Use MDAC to communicate between VBA and an external DB.

    Download MDAC and install on your computer. In VBA, make a reference to MDAC so you can use the library in your code.

    You will find plenty of information and examples of MDAC both in the documentation available from Microsoft and on the web.

    Database Content

    If you read the above article you will know that the DatabaseLink attached to an element is minimal. It matches the element with a row in a table using the MSLink (row ID) and Entity Number (table ID). If you want to store other information in the database then you must write the appropriate SQL statements, fill the parameters with the right values, and update your DB via MDAC.

    For example, the pseudo-code for adding an element's level to the DB would be something like this …

    1. Read an MSElement from a DGN model
    2. Check for a DatabaseLink
      • Match the Entity Number with your table ID (from MSCATALOG table)
      • Match the MSLink with a row in your table
    3. Get the element's level name
    4. Construct a SQL statement along the lines
      UPDATE <table> SET level='levelName' WHERE MSLINK=<mslink>

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

Children
No Data