• C#连接SQL Anywhere 12 数据库


    using System;
    using System.Data.Common;

    namespace ConsoleApplication27
    {
        class Program
        {
            static void Main(string[] args)
            {
                DbProviderFactory dbFactory = DbProviderFactories.GetFactory("iAnywhere.Data.SQLAnywhere");
                DbConnection dbconn = dbFactory.CreateConnection();

                try
                {
                    dbconn.ConnectionString = "User ID=dba;Password=sql;DataSourceName="SQL Anywhere 12 Demo"";
                    dbconn.Open();

                    if (dbconn.State == System.Data.ConnectionState.Open)
                    {
                        Console.WriteLine("Connection is Open!");

                        dbconn.Close();
                        if (dbconn.State == System.Data.ConnectionState.Closed)
                            Console.WriteLine("Connection is Closed!");
                    }
                }
                catch (DbException dbexception)
                {
                    Console.WriteLine(dbexception.Message);
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception.Message);
                }

                Console.ReadKey();
            }
        }
    }

  • 相关阅读:
    ios--->cell里面 self 和self.contentview的区别
    ios--->tableView的估算高度的作用
    ios--->泛型
    ios--->上下拉刷新控件MJRefresh
    ios--->NSNotificationCenter传值
    ios--->ios消息机制(NSNotification 和 NSNotificationCenter)
    ios--->self.view.window在逻辑判断中的作用
    ios--->ios == 和 isEqual的用法区别
    序号 斑马线显示表格的代码
    vim 显示行号
  • 原文地址:https://www.cnblogs.com/bisslot/p/3959566.html
Copyright © 2020-2023  润新知