Hello i am trying to create a notebook that automatically connects to a database on MSSQL server and would then query this to create a sort of personal report. I have connected to this database and run a few queries ok but i am having trouble with getting it to load when i open the notebook.
Needs["DatabaseLink`"]; Dynamic[ conn=OpenSQLConnection["TSQL2012"]] myOrder =SQLExecute[Dynamic[conn], "select custid, shipcountry from Sales.Orders where orderid = '10248'", "ShowColumnHeadings" ->True] //TableForm
I have been trying code such as the above but i think the Dynamic connection is trying to open to many connections to the database and then it crashes. Running the code above without the Dynamic elements in place works fine. is there a way to connect to DB when a notebook is opened and use this in SQLExecute statements?