JasonAtIntuit
Employee
Employee

This is a small C# console program I wrote which uses the ODBC connection to query the Employer name for every client in a database and print it out. This could be modified to do something else with the data. I don't have an example using the .Net library but hopefully this helps show how one could use it. You would probably want to add some error catching with a Try ... Catch at minimum.

using System;
using System.Collections.Generic;
namespace lacerte21sdktest2 { class Program { static void Main(string[] args) { //define data path containing clients var dataDir = @"C:\Lacerte\22tax\DEMODATA"; // connection string - ReturnType and TaxYear can be omitted if the DataDir contains only one type and year of data, it should figure it out var connectionString = $"Driver=LacerteDSIIDriver; ReturnType=Individual; TaxYear=2022; DataDir={dataDir}"; // create a connection to the database using (var connection = new System.Data.Odbc.OdbcConnection(connectionString)) { // first query the [DATA1-Client Info] table to get a list of clients by client number - field C1_0 var queryString = "SELECT C1_0 FROM [DATA1-Client Info]"; System.Data.Odbc.OdbcCommand command = new System.Data.Odbc.OdbcCommand(queryString); command.Connection = connection; connection.Open(); var clientList = new List(); // execute the query on the connection and loop through the result using (var reader = command.ExecuteReader()) { while (reader.Read()) { // add all of the client numbers to a list for later use - a Try Catch would be good here clientList.Add(reader.GetString(reader.GetOrdinal("C1_0"))); } } // now loop over the list of clients to get the employer name for each - need to check if clientList is empty foreach (var client in clientList) { // client details is in the [Client-Detail] table for each client, where Client is the client number // W2 employer is Series 11, Code 800 and the value is stored in the Description field var clientQueryString = $"SELECT Description FROM [{client}-Detail] WHERE Series=11 AND Code=800"; System.Data.Odbc.OdbcCommand clientCommand = new System.Data.Odbc.OdbcCommand(clientQueryString); clientCommand.Connection = connection; // execute the command and open a reader using (var reader = clientCommand.ExecuteReader()) { while (reader.Read()) { // read all of the results and just print the client number along with the employer name. // here is where you could do something else with this result, store it in a variable, etc. Console.WriteLine($"{client} employer: {reader.GetString(reader.GetOrdinal("Description"))}"); } } } } Console.WriteLine("Press any key to exit"); Console.ReadLine(); } } }

 This produces this output:

02SAMPLE employer: His Employer
02SAMPLE employer: Her Employer
03SAMPLE employer: His Employer
03SAMPLE employer: Her Employer
05SAMPLE employer: Employer1
06SAMPLE employer: His Employer
06SAMPLE employer: Her Employer
09SAMPLE employer: His Employer
09SAMPLE employer: Her Employer
10SAMPLE employer: Taxpayer New York Employer
10SAMPLE employer: Taxpayer California Employer
10SAMPLE employer: Spouse Both State Employer
11SAMPLE employer: Taxpayer New York Employer
11SAMPLE employer: Taxpayer California Employer
11SAMPLE employer: Spouse Both State Employer
12SAMPLE employer: His Employer
12SAMPLE employer: Her Employer
14SAMPLE employer: Employer Name
16SAMPLE employer: His Employer
16SAMPLE employer: Her Employer
18SAMPLE employer: Employer
21SAMPLE employer: Company
Press any key to exit 
0 Cheers
Reply