Programmer:Simple program to test connection to AutoCount Accounting v2: Difference between revisions

From AutoCount Resource Center
Content added Content deleted
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 8: Line 8:
STEP 1. Create UserSession & DBSetting
STEP 1. Create UserSession & DBSetting
STEP 2. Call (Create) SubProjectStartup
STEP 2. Call (Create) SubProjectStartup
STEP 3. Login to AutoCount Accounting
STEP 3. Login to AutoCount Accounting 2.0


{{SourceDownload|link=https://drive.google.com/open?id=10Au8sEjrY3UeDykSCcjx-cVqSgWQPzAS|remark=(Visual Studio 2017)|Download Sample Project|Sample project to test connection to AutoCount Accounting 2.0.}}
{{SourceDownload|link=https://drive.google.com/open?id=10Au8sEjrY3UeDykSCcjx-cVqSgWQPzAS|remark=(Visual Studio 2017)|Download Sample Project|Sample project to test connection to AutoCount Accounting 2.0.}}
Line 14: Line 14:
<br />
<br />


==DBSetting==
==UserSession and DBSetting==
'''DBSetting''' is one of the most frequently used class in AutoCount Accounting, whether it is plug-in or integrating system.
'''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 or application script, you may find the object of DBSetting is provided.<br />
Even when writing scripting for report script and application script, you may find the object of UserSession and DBSetting are provided.<br />
DBSetting is required by all transactions and documents when accessing to database server is needed.<br />
UserSession and DBSetting are required by almost all transactions and documents when accessing to AutoCount server.<br />
Moreover, it provides methods such as GetDataTable(...), ExecuteScalar(...), ExecuteNonQuery(...) and more for programmer to easily access to currently connected account book.<br />
Moreover, it provides methods such as GetDataTable(...), ExecuteScalar(...), ExecuteNonQuery(...) and more for programmer to access currently connected account book.<br />
During its creation, two pieces of information is important, they are the '''server name''' and '''database name'''.
During its creation, two pieces of information is important, they are the '''server name''' and '''database name'''.


Namespace: BCE.Data
Namespace: AutoCount.Data


===Create DBSetting with AutoCount default configuration===
===Create DBSetting with AutoCount default configuration===
Line 27: Line 27:
Below example code shows the DBSetting is created with new operator.
Below example code shows the DBSetting is created with new operator.
<syntaxhighlight lang="csharp">
<syntaxhighlight lang="csharp">
BCE.Data.DBSetting dbSetting = new BCE.Data.DBSetting(DBServerType.SQL2000, serverName, dbName);
AutoCount.Data.DBSetting dbSetting = new AutoCount.Data.DBSetting(DBServerType.SQL2000, serverName, dbName);
</syntaxhighlight>
</syntaxhighlight>


* DBServerType which is the First parameter is always DBServerType.SQL2000, regardless of which Microsoft SQL Server version is being applied.
* DBServerType which is the First parameter is always DBServerType.SQL2000, regardless of which Microsoft SQL Server version is being applied.
* To obtain available '''Server Name''' and '''Database Name''':
* To obtain available '''Server Name''' and '''Database Name''':
** Programatically, you may refer to "[[Programmer:Create BCE.Data.DBSetting with Database Info|Create BCE.Data.DBSetting with Database Info in AutoCount Accounting 1.8]]".
** Programatically, you may refer to "[[Programmer:Create AutoCount.Data.DBSetting with Database Info|Create AutoCount.Data.DBSetting with Database Info in AutoCount Accounting 2.0]]".
** Manually, at the login screen of AutoCount Accounting.
** Manually, at the login screen of AutoCount Accounting.
::[[File:ProgramLoginForm.png|450px|link=]]
<br />
<br />
===Create DBSetting while specifying SQL Server sa password===
===Create DBSetting while specify SQL Server sa password===
<syntaxhighlight lang="csharp">
<syntaxhighlight lang="csharp">
BCE.Data.DBSetting dbSetting = new BCE.Data.DBSetting(DBServerType.SQL2000, serverName, "sa", "mYsApAsSwOrD", dbName);
AutoCount.Data.DBSetting dbSetting = new AutoCount.Data.DBSetting(DBServerType.SQL2000, serverName, "sa", "mYsApAsSwOrD", dbName);
</syntaxhighlight>
</syntaxhighlight>
* sa login password can be omitted when the password is using AutoCount default sa login password.
* sa login password can be omitted when the password is using AutoCount default sa login password.
Line 47: Line 46:
<br />
<br />


<!--
==SubProjectStartupWithLogin==
==SubProjectStartupWithLogin==
*When using '''SubProjectStartupWithLogin''' it does the following tasks:
*When using '''SubProjectStartupWithLogin''' it does the following tasks:
Line 135: Line 135:
}
}
</syntaxhighlight>
</syntaxhighlight>
-->


<br/>
<br/>
==See Also==
==See Also==
*[[Programmer:Simple program to test connection to AutoCount Accounting v2|A simple program to test connection to AutoCount Accounting 2.0]]
*[[Programmer:Simple program to test connection to AutoCount Accounting v2|A simple program to test connection to AutoCount Accounting 2.0]]
*[[Programmer:Create BCE.Data.DBSetting with Database Info|Create BCE.Data.DBSetting with Database Info in AutoCount Accounting 1.8]]
*[[Programmer:Simple program to test connection to AutoCount Accounting|A simple program to test connection to AutoCount Accounting 1.8/1.9]]
*[[Programmer:Create BCE.Data.DBSetting with Database Info|Create BCE.Data.DBSetting with Database Info in AutoCount Accounting 1.8/1.9]]
*[[Invalid LCPDecryptFileException was unhandled]]
*[[Invalid LCPDecryptFileException was unhandled]]
<br />
<br />

Latest revision as of 10:30, 8 April 2019

[DRAFT]

Version Applicable

AutoCount Accounting 2.0.7.115 and higher

Introduction

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
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.


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

Go to top
Resources For AutoCount Software Developers