Microsoft Dynamics Forums Homepage

Forum Home Forum Home > Microsoft Dynamics GP (Great Plains) > GP - Installation and Administration
  New Posts New Posts RSS Feed - Passwords for datasource in GP
  FAQ FAQ  Forum Search   Register Register  Login Login


Passwords for datasource in GP

 Post Reply Post Reply
Author
Message
I hate GP View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: March 02 2007
Location: Puerto Rico
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote I hate GP Quote  Post ReplyReply Direct Link To This Post Topic: Passwords for datasource in GP
    Posted: March 15 2007 at 1:41pm
I've been coding cheap code lately, and I really have to stop..
I want to know how can I create a datasource connection to the GreatPlains DB without the whole mess with the password?
 
Let me explain.
 
Usually, when one wants to create a data connection with ADODB, he/she would declare an ADODB.Connection object to create the connection, as well as an ADODB.Recordset object to hold the results of an SQL query. An example would be something like the following:
 
Dim cn As Object
Dim rs As Object
 
Set cn = new ADODB.Connection
Set rs = new ADODB.RecordSet
 
cn.ConnectionString = "Provider=MSDASQL;Data Source='MYGPDS';User ID='SA';Password='PASSWORD';Initial Client='TWO';"
rs.Open "Select * FROM RM00101 Where CUSTNMBR='Whatever'", cn, 0, 3
 
...
 
Okay, my question is, if I don't know the password to the datasource, how do I retrieve it programmatically, Or, How do I log in without having to enter a username and password? I ask because I have to install my mods (packages) on different computers for different companies, and to hardcode the password is not only cheap, but also leads to problems when installing the package on a computer where the datasource connection password is not "PASSWORD".
 
I've tried omitting the User ID and Password parameter with no success.
Also, I tried getting the password from the "WelcometoMicrosoftDynamics" window (modified), it works, but sometimes the variables holding the password values empty themselves out of the blue. Anybody know any alternatives?
 
 
Unoptimized code is useless code -- Type. Crash. Burn.
Back to Top
Sponsored Links


Back to Top
I hate GP View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: March 02 2007
Location: Puerto Rico
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote I hate GP Quote  Post ReplyReply Direct Link To This Post Posted: March 15 2007 at 2:12pm
Noticed some typos or whatever.. the connectionstring should be:
 
cn.ConnectionString = "Provider=MSDASQL;Data Source='MYGPDS';User ID='SA';Password='PASSWORD';Initial Catalog='TWO';"
 
and below it should be:
cn.Open
 
Just addressing them because it's correct in the actual code.. (gotta stop skipping coffee breaks..)
 
Anyway, anybody have a solution or know if it's even possible? Please help.
Unoptimized code is useless code -- Type. Crash. Burn.
Back to Top
RobFleming View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: March 16 2007
Location: United States
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote RobFleming Quote  Post ReplyReply Direct Link To This Post Posted: March 16 2007 at 7:09pm
Use the .dll provided by microsoft called retreiveglobals.dll. It'll pull login info from the GP session; you drop that login info into your connection string.  The only problem I've seen with it is that sometimes the object won't intstatiate and that causes problems; and the password for sa will not be returned.
 
It's a great way to provide a login w/out having uname/password combinations for your VBA mods.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down


Copyright 2013 microsoftdynamicsforums.com. All rights reserved. MicrosoftDynamicsForums.com is an independent non-Microsoft website.
Email: contact AT microsoftdynamicsforums DOT com