Programmer:Simple program to test connection to AutoCount Accounting v2

From AutoCount Resource Center

Version Applicable

AutoCount Accounting and higher


In order to connect to one of the account book of AutoCount Accounting 2.0, there are few steps to start with.
To understand each of the steps, a program is written to test the result of each step.
STEP 1. Create UserSession & DBSetting STEP 2. Call (Create) SubProjectStartup STEP 3. Login to AutoCount Accounting 2.0
VSProjectIcon.png Download Sample Project (Visual Studio 2017)

Sample project to test connection to AutoCount Accounting 2.0.


UserSession and DBSetting

UserSession and DBSetting are the most frequent use classes in AutoCount Accounting 2.0, whether it is plug-in or integrate system.
Even when writing scripting for report script and application script, you may find the object of UserSession and DBSetting are provided.
UserSession and DBSetting are required by almost all transactions and documents when accessing to AutoCount server.
Moreover, it provides methods such as GetDataTable(...), ExecuteScalar(...), ExecuteNonQuery(...) and more for programmer to access currently connected account book.
During its creation, two pieces of information is important, they are the server name and database name.
Namespace: AutoCount.Data

Create DBSetting with AutoCount default configuration

DBSetting object can be created with new operator, or via SubProjectStartupWithLogin method.
Below example code shows the DBSetting is created with new operator.

AutoCount.Data.DBSetting dbSetting = new AutoCount.Data.DBSetting(DBServerType.SQL2000, serverName, dbName);

Create DBSetting while specify SQL Server sa password

AutoCount.Data.DBSetting dbSetting = new AutoCount.Data.DBSetting(DBServerType.SQL2000, serverName, "sa", "mYsApAsSwOrD", dbName);
  • sa login password can be omitted when the password is using AutoCount default sa login password.
  • Specify the sa password only when sa password has been changed.

Warning-icon.png Success of created DBSetting does not justify whether the provided information connecting to SQL Server is correct.
DBSetting merely store the information that is essential to connect SQL Server.

See Also

Go to menu

IconAC81.png Go to top
ProgrammerGo.jpg Resources For AutoCount Software Developers