接上文

数据库安装好后,也可以测试语句了.

下面我们用c#写一个控制台程序,连接数据库,并读取数据.

一 下载驱动  net版的下 CUBRID ADO.NET Data Provider 9.3.0.0001.zip 这个就可以.解压后里面有一个CUBRID.Data.dll

二 创建控制台,添加对CUBRID.Data.dll的引用

三 写代码

如下

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();
}
}
}

  结果如下:

其中

AutoCommit  是否自动提交事务
我简单的理解 :如果不手动用事务的话 ,可以开启.如果手动控制事务的话 ,关闭它  .  然后 手动提交 COMMIT WORK;
SetAutoCommit的说明如下 :

 sql语句中: AUTOCOMMIT IS OFF
CCI_DEFAULT_AUTOCOMMIT

CCI_DEFAULT_AUTOCOMMIT is a parameter used to configure whether to make application implemented in CCI interface or CCI-based interface such as PHP, ODBC, OLE DB, Perl, Python, and Ruby commit automatically. The default value is ON. This parameter does not affect applications implemented in JDBC. In case of using ODBC, malfunction can occur if this parameter is ON; you must set it to OFF, in this case.

If the CCI_DEFAULT_AUTOCOMMIT parameter value is OFF, the broker application server (CAS) process is occupied until the transaction is terminated. Therefore, it is recommended to execute commit after completing fetch when executing the SELECTstatement.

c#,net,cubrid,教程,学习,笔记欢迎转载 ,转载时请保留作者信息。本文版权归本人所有,如有任何问题,请与我联系wang2650@sohu.com 。 过错

Note The CCI_DEFAULT_AUTOCOMMIT parameter has been supported from 2008 R4.0, and the default value is OFF for the version. Therefore, if you use CUBRID 2008 R4.1 or later versions and want to keep the configuration OFF, you should manually change it to OFF to avoid auto-commit of unexpected transaction.

更详细的文档 http://www.cubrid.org/wiki_apis/entry/ado-net-driver-development-notes  最新版是9.3了,这个文章是8的.

如果感兴趣可以看源码吧

CUBRID学习笔记 3 net连接数据库并使用cubrid教程示例的更多相关文章

  1. CUBRID学习笔记 44 UPDATE 触发器 更新多表 教程

    cubrid的中sql查询语法UPDATE c#,net,cubrid,教程,学习,笔记欢迎转载 ,转载时请保留作者信息.本文版权归本人所有,如有任何问题,请与我联系wang2650@sohu.com ...

  2. Node.js学习笔记(3):NPM简明教程

    Node.js学习笔记(3):NPM简明教程 NPM常用操作 更新NPM版本 npm install npm -g -g,表示全局安装.我们可以指定更新版本,只需要在后面填上@版本号即可,也可以输入@ ...

  3. amazeui学习笔记一(开始使用2)--布局示例layouts

    amazeui学习笔记一(开始使用2)--布局示例layouts 一.总结 1.样例分析(不要忘记,优先分析这个布局示例):有教你页面怎么布局的,实例中可以分析一波 2.响应式:对应meta标签中的v ...

  4. Node.js学习笔记(4):Yarn简明教程

    Node.js学习笔记(4):Yarn简明教程. 引入Yarn NPM是常用的包管理工具,现在我们引入是新一代的包管理工具Yarn.其具有快速.安全.可靠的特点. 安装方式 使用npm工具安装yarn ...

  5. CUBRID学习笔记 4 端口和win7下连接数据库cubrid教程

    都是官方的文档 ,水平有限, 大家可以看原文. http://www.cubrid.org/wiki_tutorials/entry/connecting-to-a-remote-cubrid-dat ...

  6. CUBRID学习笔记 48查询优化

    cubrid的中sql查询语法 查询优化 c#,net,cubrid,教程,学习,笔记欢迎转载 ,转载时请保留作者信息.本文版权归本人所有,如有任何问题,请与我联系wang2650@sohu.com ...

  7. CUBRID学习笔记 47 show

    cubrid的中sql查询语法show c#,net,cubrid,教程,学习,笔记欢迎转载 ,转载时请保留作者信息.本文版权归本人所有,如有任何问题,请与我联系wang2650@sohu.com . ...

  8. CUBRID学习笔记 46 PREPARED set Do

    cubrid的中sql查询语法PREPARED set Do c#,net,cubrid,教程,学习,笔记欢迎转载 ,转载时请保留作者信息.本文版权归本人所有,如有任何问题,请与我联系wang2650 ...

  9. CUBRID学习笔记 45 REPLACE DELETE MERGE 教程

    c#,net,cubrid,教程,学习,笔记欢迎转载 ,转载时请保留作者信息.本文版权归本人所有,如有任何问题,请与我联系wang2650@sohu.com . 过错 ------ 官方文档是英文的, ...

随机推荐

  1. MyBatis的Dao层注入SqlSession

    有点坑爹,以前没用过Mybatis,最近才用,而且一直用Mybatis推荐的接口映射的方式,但是今天有人告诉我接口方式用得少,大多还是采用从配置文件里面读sql的方式,当然接口也是类似的,都是利用ma ...

  2. Majority Element

    #include<map> using namespace std;class Solution {public:    int majorityElement(vector<int ...

  3. PHP安全函数phpinfo()

    phpinfo() 功能描述:输出 PHP 环境信息以及相关的模块.WEB 环境等信息. 危险等级:中 passthru() 功能描述:允许执行一个外部程序并回显输出,类似于 exec(). 危险等级 ...

  4. 23、jQuery九类选择器/jQuery常用Method-API/jQuery常用Event-API

      1)掌握jQuery九类选择器及应用 2)掌握jQuery常用Method-API 3)掌握jQuery常用Event-API 一)jQuery九类选择器[参见jQueryAPI.chm手册] 目 ...

  5. HDU 5934:Bomb(强连通缩点)

    http://acm.hdu.edu.cn/showproblem.php?pid=5934 题意:有N个炸弹,每个炸弹有一个坐标,一个爆炸范围和一个爆炸花费,如果一个炸弹的爆炸范围内有另外的炸弹,那 ...

  6. 完整学习git四git对象

    1查看git对象 git cat-file 实践 git head到底指向的是什么 ➜ gittest git:(master) find .git -name HEAD -o -name maste ...

  7. [Unity3D][Vuforia][ios]使用vuforia的unity3d库在ios中摄像头只显示黑色,不显示摄像头,NO CAMERA的解决方案

    注:我使用的是Vuforia 4.0SDK Unity3D5.0版本,跑的ios系统为8.1 我在Vuforia官方讨论贴子中看到这其实是新手都会遇到的问题 贴子地址: https://develop ...

  8. poj3342 Party at Hali-Bula

    树形dp题,状态转移方程应该很好推,但一定要细心. http://poj.org/problem?id=3342 #include <cstdio> #include <cstrin ...

  9. A Round Peg in a Ground Hole(凸包应用POJ 1584)

    A Round Peg in a Ground Hole Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 5684 Accepte ...

  10. Pie(二分POJ3122)

    Pie Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12985   Accepted: 4490   Special Ju ...