Connect to the above
After the database is installed, you can also test the statement.
Below we write a console program in C #, connect to the database, and read the data.
Download the drive NET version of the next Cubrid ADO Provider 9.3.0.0001.zip This can be. After the decompression there is a CUBRID.Data.dll
Two create the console, add a reference to the CUBRID.Data.dll
Three-write code
As follows
Using system;using system.collections.generic;using system.linq;using system.text;using CUBRID. Data.cubridclient;namespace Cubridtest {class Program {static void Main (string[] args) {Cubrid. Data.CUBRIDClient.CUBRIDConnectionStringBuilder sb = new Cubridconnectionstringbuilder (); Sb. User = "public"; Sb. Database = "Demodb"; Sb. Port = "33000"; Sb. Server = "192.168.2.156"; Sb. Password = ""; using (cubridconnection conn = new Cubridconnection (sb.) GetConnectionString ())) {Conn. Open (); Conn. Setautocommit (FALSE); using (cubridcommand cmd = new Cubridcommand ("SELECT * FROM athlete limit 1,10", conn)) {using (System.Data.Common.DbDataReader reader = cmd.) ExecuteReader ()) {while (reader. Read ()) {Console.WriteLine (reader[0]. ToString () + ";");}}} } console.readkey (); }}}
The results are as follows:
which
Setautocommit's instructions are as follows
Cci_default_autocommit
Cci_default_autocommit is a parameter used to configure whether to make application implemented in CCI interface or CCI-BA Sed interface such as PHP, ODBC, OLE DB, Perl, Python, and Ruby commit automatically. The default value is on . This parameter does isn't affect applications implemented in JDBC. In case of using ODBC, the malfunction can occur if this parameter are on; must set it to OFF
If the Cci_default_autocommit parameter value is OFF, the broker Application Server (CAS) process is occupied unti L The transaction is terminated. Therefore, it's recommended to execute commit after completing fetch when executing the selectstatement.
Note The Cci_default_autocommit parameter have been supported from R4.0, and the DEFAULT value are OFF for the Version. Therefore, if you use Cubrid-R4.1 or later versions and want to keep the configuration OFF, you should manually C Hange it to OFF to avoid auto-commit of unexpected transaction.
More detailed documentation http://www.cubrid.org/wiki_apis/entry/ado-net-driver-development-notes the latest version is 9.3, this article is 8.
If you're interested, look at the source.
Cubrid Learn notes 3 net connect a database and use