C#操作Advantage Database Server

简单Demo:

引用 D:\Program Files (x86)\Advantage 11.10\ado.net\2.0\Advantage.Data.Provider.dll

using System;
using Advantage.Data.Provider;  

namespace ADSDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            // create a connection object
           // AdsConnection conn = new AdsConnection("data source=c:\\data;" +
            //"ServerType=remote|local; TableType=ADT");

            //AdsConnection conn = new AdsConnection();
            //conn.ConnectionString = "data source=c:\\data\\Demo2.add; " +
            //"user id = adssys; password = ‘‘ " +
            //"ServerType=local; TrimTrailingSpaces = true";

            //AdsConnection conn = new AdsConnection();
            //conn.ConnectionString = "data source=c:\\data\\Demo2.add; " +
            //"user id = adssys;  " +
            //"ServerType=local; TrimTrailingSpaces = true";

            AdsConnection conn = new AdsConnection();
            conn.ConnectionString = "data source=c:\\data\\Demo2.add; " +
            "ServerType=local; TrimTrailingSpaces = true";

            AdsCommand cmd;
            AdsDataReader reader;
            int iField;
            try
            {
                conn.Open();
                // create a command object
                cmd = conn.CreateCommand();
                // specify a simple SELECT statement
                cmd.CommandText = "select * from users";
                // execute the statement and create a reader
                reader = cmd.ExecuteReader();
                // dump the results of the query to the console
                while (reader.Read())
                {
                    for (iField = 0; iField < reader.FieldCount; iField++)
                        Console.Write(reader.GetValue(iField) + " ");
                    Console.WriteLine();
                }
                conn.Close();
            }
            catch (AdsException e)
            {
                Console.WriteLine(e.Message);

            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.ReadKey();
        }
    }
}

  

C#操作Advantage Database Server

时间: 2024-10-07 11:48:13

C#操作Advantage Database Server的相关文章

通过dbcp链接池对数据库操作报 Cannot create PoolableConnectionFactory (Could not create connection to database server. Attempted reconnect 3 times. Giving up.)--解决方案

org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (Could not create connection to database server. Atte

sqlite:多线程操作数据库“database is locked”解决方法(二)

上一篇博客<sqlite:多线程操作数据库“database is locked”解决方法>通过注册延时函数的方法来处理数据库被锁的问题.此方法固然能解决问题,但是在多个线程向数据库写入大量数据的情况下,延时会拖慢进度. 想出方法二: 1. 创建一个链表,链接如下格式的结构体,线程1,线程2,线程3......不直接改写数据库,而是把sql语句插入链表中: typedef struct { uint8_t *buf; uint32_t len; } sqlItem_t; 2. 创建一个独立的线

11.2.0.3.0 PATCH SET FOR ORACLE DATABASE SERVER for windows (32bit)

Patch 10404530 [使用迅雷直接下载]   11.2.0.3.0 PATCH SET FOR ORACLE DATABASE SERVER for linux x86-64 https://updates.oracle.com/Orion/Services/download/p10404530_112030_Linux-x86-64_1of7.zip?aru=14125322&patch_file=p10404530_112030_Linux-x86-64_1of7.zip http

jmeter连接mysql数据库报错Cannot create PoolableConnectionFactory (Could not create connection to database server.)

今天在学习jmeter的jdbc取样器,发现在配置完JDBC Connection Configuration和JDBC Request后,点击运行.在查看结果树中显示响应数据: Cannot create PoolableConnectionFactory (Could not create connection to database server.) 尝试多种方法后发现是由于mysql驱动版本太低导致. 报错时,我的jmeter版本是3.1,jdk版本是1.8,mysql版本是8.0.11

jeecg启动报错“com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.”的解决办法

在运行"maven build"-->"tomcat:run"之后,报如下错误: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

Kernel parameters for Db2 database server installation (Linux and UNIX)

Db2 11.1 For root installations, the database manager uses a formula to automatically adjust kernel parameter settings and eliminate the need for manual updates to these settings. Before you begin You must have root authority to modify kernel paramet

Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Could not create connection to database server.

报错信息:Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Could not create connection to database server.) 问题来源mysql-connecter-java 版本过低 如果你mysql的版本是m

centos7 mysql 启动mysqld.service - SYSV: MySQL database server错误

1.启动命令 systemctl start mysqld.service 或者 /etc/init.d/mysqld start   结果同样的错误 2.错误是: Job for mysqld.service failed. See 'systemctl status mysqld.service' and 'journalctl -xn' for details. 3.按照提示输入命令 systemctl status mysqld.service 或者 journalctl -xn 命令后

Failed to start MariaDB database server. (已解决) 之前配过主从

[[email protected] /var/log/mariadb]# systemctl status mariadb.service● mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Mon