Creating MSSQL DB Connection

I could not find any documentation, really anywhere on how to connect to a MSSQL database on here through Dynamo, rather than a MySQL or SQLite DB that you can connect to through Slingshot.

The following post was a start:

http://dynamobim.org/forums/topic/connection-to-ms-sql-with-slingshot/

But, in the end, it need some more content for my connection to work consistently.

The biggest hiccup was the conn_string has to be very precise in how it is laid out. After every semi-colon, there cannot be a space and particularly the data source and database both have to be CAPITALIZED, otherwise no go.

I also had some difficulties with the ‘while()’ loop later. I was getting some content that can back from the DB that contained nulls. I am just displaying some of this information back to the user, so, removing the nulls and changing to something that can be interpreted by the general public would be useful, which is where the “not System.STring.IsNullOrEmpty” came in.

For those of you who come later, here you go. May not be perfect, but works.

1 Like

@kraftwerk15

thanks for sharing

You can use slingshot with an ODBC connection string.
i.e you could connect to MSSQL as shown here:
http://dynamobim.org/forums/topic/revit-dynamo-access-datgabase/

Refer here for connection strings:
https://www.connectionstrings.com/microsoft-sql-server-odbc-driver/

Andrew

1 Like

I made a couple of nodes to connect to SQL Server DB. Try DynaTools and let me know!

1 Like