thank you, JVierra!
*that* was the issue.
and Happy Thanksgiving to you!
posh studio EXE gets an ODBC connection error
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- fvenezia65
- Posts: 8
- Last visit: Wed Feb 14, 2024 9:44 am
Re: posh studio EXE gets an ODBC connection error
I was pretty sure that was the issue as it is quite common. See "help about scopes" to understand how "scope" is implemented in PowerShell.
And Happy Thanksgiving to you too. Watch out for the cranberries...they can be a challenge.
Observe the following: https://www.youtube.com/watch?v=8MuhFxaT7zo
And Happy Thanksgiving to you too. Watch out for the cranberries...they can be a challenge.
Observe the following: https://www.youtube.com/watch?v=8MuhFxaT7zo
- fvenezia65
- Posts: 8
- Last visit: Wed Feb 14, 2024 9:44 am
Re: posh studio EXE gets an ODBC connection error
wondering if putting the function in a .PSM1 might make it work.
going to try tomorrow.
thanks again!
-frank
going to try tomorrow.
thanks again!
-frank
Re: posh studio EXE gets an ODBC connection error
See "help about scopes"
It doesn't matter where you put it, the object has to be "in scope". and object declared in a module or function will dispapear from all scopes when the function exits. It is better to vae a function that returns a connection object or, better, a function that returns a DataTable object and releases the connection and other objects. Now scope is no longer a barrier to acquiring a data object.
Best you learn PowerShell first then you will understand that PowerShell is an object system and not a batch scripting language or an old language like "Basic". We have abandoned those old things more than 20 years ago.
PowerShell can be used as a batch scripting system but as soon as you do more than list independent commands then all bets are off the table and you will get lost in a second.
Reading the help on scopes will solve that issue and the help is built-in and should be your first place to understand commands, tokens, syntax, grammar and behaviors. Once you get the flavor of a modern coded system then the rest will become so easy that you will wonder why you started by trying to just copy and guess.
Good luck, have fun and break through the mental barriers that all of us have difficulties breaking through.
It doesn't matter where you put it, the object has to be "in scope". and object declared in a module or function will dispapear from all scopes when the function exits. It is better to vae a function that returns a connection object or, better, a function that returns a DataTable object and releases the connection and other objects. Now scope is no longer a barrier to acquiring a data object.
Best you learn PowerShell first then you will understand that PowerShell is an object system and not a batch scripting language or an old language like "Basic". We have abandoned those old things more than 20 years ago.
PowerShell can be used as a batch scripting system but as soon as you do more than list independent commands then all bets are off the table and you will get lost in a second.
Reading the help on scopes will solve that issue and the help is built-in and should be your first place to understand commands, tokens, syntax, grammar and behaviors. Once you get the flavor of a modern coded system then the rest will become so easy that you will wonder why you started by trying to just copy and guess.
Good luck, have fun and break through the mental barriers that all of us have difficulties breaking through.