Running a SQL query from microstation V8i (Select Series 3) Addin - c# programming

All,

We have developed an ADDIN that fetches information from database into a gridview. So far ADDIN prompts user for Database connection details and forms a OLEDB connection string to connect to the database. 

I would like to know of any API or Database Key-in Utility to execute SQL's using the default Oracle Connection.  Could someone help me out on this?

  • In the MicroStation MDL API you could use the mdlDB_processSQL function to submit general non-SELECT SQL statements to the database server.

    You can also use SQL pass-thru processing by forming a keyin that starts with the pipe (vertical bar "|") character such as follows:

    |update myTable a set a.myValue=100 where a.myKey=1;

    Regards,

    Jeff Bielefeld [Bentley]



  • Jeff,

    Thanks for your quick response.

    So I have to use OLEDB/ODP.NET to run SELECT statements. 

    I have one more question related to .NET 4.0 compatibility. When we started ADDIN development Microstation doesn't support .NET 4.0 (as per our testing) and only loads ADDINs developed in .NET 3.5. Is this still the same?

  • In the MicroStation MDL API you could use the mdlDB_openCursor[WithId], mdlDB_fetchRow[ById] and mdlDB_closeCursor[WithId] functions to run SELECT statements. While the MicroStation database servers and related API functions work well, it would seem that use of ODP.NET would be a better option for your .NET based addin. For MicroStation V8i based products, I don't believe .NET 4.0 is supported, requiring as you found .NET 3.5 framework.

    Regards,

    Jeff Bielefeld [Bentley]



  • Thanks a lot, Above post answers all my questions.

    ODP.NET works well for our requirement but the only problem is we can not use the default Oracle connection (Configured in GSA) and prompt user for Database details and run code to change the workspace to current user workspace.
  • Jeff,

    I have one more question related to Database properties. I have seen OracleConnectionInfo class in DataInterchange namespace to create a new connection and would like to know if there are any methods in this class to retrieve the existing connection properties ( except password ).