Monday, January 12, 2015

Server field is blank when you launch Dynamics GP due to space at beginning of DSN

By Steve Endow

I just had a call with a client whose Dynamics GP Server field was always blank when they launched GP.



The drop down list had entries, and the user could log into GP, but every time they launched GP, they had to re-select the Server value.


I checked the Dex.ini file and saw that it did have a SQLLastDataSource value.

SQLLastDataSource= Dynamics GP 2013

I noticed that there was a space at the between the equal sign and the name, so I removed the space, saved the Dex.ini and relaunched GP, but that didn't resolve the issue.

I then found this KB article, but it discusses a completely blank Server drop down list--not a Server field value that remains blank and doesn't doesn't display a default value.

But based on that article, I decided to double check the ODBC DSN settings.  We confirmed that the GP DSN was present in the 32-bit ODBC settings window and was using the proper SQL driver, so I was stumped.

On a whim, I decided to confirm the DSN settings, and that's when I saw the likely culprit.


Did you catch that?  See the issue?

Look again:


Notice that there is a sliver of blue before the word Dynamics?

There was a space in front of the DSN name.

The client had manually created their Dynamics GP DSNs, and in the process had accidentally typed a space at the beginning of the name.

We removed the space from the beginning of the DSN name, relaunched GP, and the Server value defaulted just fine.

Apparently Dynamics GP can't handle a DSN that starts with a space.  The DSN will work, but it will never default in the Server field when you launch Dynamics GP.

Whenever I think I've seen all of the GP oddities, a new one pops up right on queue.

Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter



1 comment:

Patrick Roth said...

Good catch and interesting issue.

Dexterity pulls the list of DNS's from the registry and then filters them to only show the SQL ones (old versions of gp just showed every DSN).

The dex.ini is read via Dexterity Defaults_Read which in C++ runtime calls the GetPrivateProfileString Win32 method.

Dexterity then loops through the list of DSN's looking for the key read from the dex.ini and sets the DDL to the value it finds.

So i would imagine the underlying issue is that the GetPrivateProfileString method to read the ini file skips the leading space. And since the DSN _does_ have a leading space, it isn't stripped since that is the real value.

Since _Dynamics GP 2013 != Dynamics GP 2013, it doesn't default any more than "the server" would.

But it is interesting to note that when GP writes back the "_Dynamics GP 2013" value the user selected, the space IS preserved and you get yourself in this loop.

patrick roth
eone solutions