Slingshot! and Microsoft SQL

I am trying to edit a database setup in Microsoft SQL Sever Manager and have noticed that the Slingshot package seems to only have 4 command nodes. Has anyone been successful in using Slingshot with Microsofts SQL software?

Yes, it works fine
You just use a code block to build the ‘command’, rather than nodes such as SQL.InsertInto- for example if you wanted an UPDATE query

MSSQL can be a little tricky with things like authentication, named instances (servers) vs default instances, security or connection settings, firewall etc etc- but it does work. For this reason, I’d recommend SQLite if you are starting from scratch- it is very simple & easy.

Search on this forum for posts by myself or others for SQL

I have recently been working with exporting bulk information from rvt files to a database, I’ve tried using the slingshots nodes with no luck, so it took me a while but I worked it out by using .Net Api SqlClient and I’m able to do any operation from dyamo to a MSSQL DB.

import clr
clr.AddReference(‘System.Data’)
from System.Data import SqlClient
from System.Data import *
from System.Data import DataTable

import clr
clr.AddReference(‘System’)
from System import *
from System import Console
from System import Data
from System.Collections.Generic import *

sqlConnectionString = “server=servername;database=databasename;uid=login;password=yourpassword”
sqlDbConnection = SqlClient.SqlConnection(sqlConnectionString)
sqlDbConnection.Open()

command = SqlClient.SqlCommand
command = sqlDbConnection.CreateCommand()

transaction = SqlClient.SqlTransaction
transaction = sqlDbConnection.BeginTransaction(“SampleTransaction”)

command.Connection = sqlDbConnection
command.Transaction = transaction

command.CommandText = “DELETE FROM you_table WHERE x = @Id
command.Parameters.Add("@Id", SqlDbType.Int).Value = 100
command.ExecuteNonQuery()
transaction.Commit()

sqlDbConnection.Close()
OUT = 0

2 Likes

This was gold for me! After a bit of messing around with it I can now track and log all the information I want on Dynamo usage in our network. Work flawlessly with MSSQL Thank you!

I’m glad I was able to help you just a bit, next time I’ll try to add some comments to my code and specify the sections. Good luck.

1 Like


hello,
can someone please tell me how do I load the slingshot package into dynamo?