下面的样例代码使用连接字符串通过GBASE南大通用Connection 类创建连接对象、
打开连接、关闭连接GBASE南大通用。
C# 示例:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Data;
using GBase.Data.GBaseClient;
namespace UsingAdoNet
{
class Program
{
static void Main(string[] args)
{
String _ConnStr = "server=192.168.5.41;user
id=root;password=1;database=test;port=5258;pooling=false";
using (GBaseConnection _Conn = new GBaseConnection())
{
try
{
_Conn.ConnectionString = _ConnStr;
_Conn.Open();
// do something
}
catch (GBaseException ex)
{
Console.WriteLine(ex.StackTrace);
}
finally
{
if( _Conn != null )
_Conn.Close();
}
}
}
}
}
操作数据库