frust23 11/1/2023 2:17:15 PM

Trying to create a db connection in vb.net using active GP user credentials

I am running the latest GP version. In GP's VB editor, if I added validation to a field by checking its value against conditions for data in other tables, I would use UserInfoGet.CreateADOConnection to create a connection to query the SQL server.  Since that VB code doesn't work on Windows Server 2019 and after, I have decided to code the validation for the field in vb.net using Visual Studio 2022.  I have added the GP tools to VS, created a GP vb.net project, added GPConn, GPConnNet, and Dynamics.ModifiedForms to the Project, coded Imports for GPConn and Microsoft.Dexterity. GPConnection.  I need a way to pass the user's credentials to create a data connection in vb.net, as UserInfoGet is not recognized in vb.net with the references I have installed.  I don't want to have to hard code sa credentials in the script or call an ODBC connection (that uses sa credentials) to run a simple query.

Could someone show a good way with vb.net to pass the active GP user credentials to a data connection so I can run a SQL query?  If not, should I use C#, and what would the options be there?

Thank you.

Version: All
Section: .NET Development, Dynamics GP, Visual Studio Tools for Dynamics GP


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3