C#数据库连接字符串——Sybase

  1. ODBC DSN
  2. ODBC -- Sybase System 12 (12.5) ODBC Driver
  3. ODBC -- Sybase System 11 ODBC Driver
  4. ODBC -- Intersolv 3.10 ODBC Driver
  5. ODBC -- SQL Anywhere
  6. OleDb -- Sybase Adaptive Server Enterprise (ASE)
  7. .NET DataProvider from Sybase

 

  1. // ODBC DSN    
  2.  
  3. using System.Data.Odbc;  
  4.  
  5. OdbcConnection conn = new OdbcConnection();  
  6. conn.ConnectionString =   
  7.               "Dsn=DsnName;" +   
  8.               "Uid=UserName;" +   
  9.               "Pwd=Secret;";   
  10. conn.Open();   
  1. // ODBC -- Sybase System 12 (12.5) ODBC Driver    
  2.  
  3. using System.Data.Odbc;  
  4.  
  5. OdbcConnection conn = new OdbcConnection();  
  6. conn.ConnectionString =   
  7.               "Driver={SYBASE ASE ODBC Driver};" +   
  8.               "Srvr=ServerName;" +   
  9.               "Uid=UserName;" +   
  10.               "Pwd=Secret;";   
  11. conn.Open();   
  1. // ODBC -- Sybase System 11 ODBC Driver    
  2.  
  3. using System.Data.Odbc;  
  4.  
  5. OdbcConnection conn = new OdbcConnection();  
  6. conn.ConnectionString =   
  7.            "Driver={SYBASE SYSTEM 11};" +   
  8.            "Srvr=ServerName;" +   
  9.            "Uid=UserName;" +   
  10.            "Pwd=Secret;";   
  11. conn.Open();  
  12.    
  1. // ODBC -- Intersolv 3.10 ODBC Driver    
  2.  
  3. using System.Data.Odbc;  
  4.  
  5. OdbcConnection conn = new OdbcConnection();  
  6. conn.ConnectionString =   
  7.         "Driver={INTERSOLV 3.10 32-BIT Sybase};" +   
  8.         "Srvr=ServerName;" +   
  9.         "Uid=UserName;" +   
  10.         "Pwd=Secret;";   
  11. conn.Open();   
  1. // ODBC -- SQL Anywhere    
  2.  
  3. using System.Data.Odbc;  
  4.  
  5. OdbcConnection conn = new OdbcConnection();  
  6. conn.ConnectionString =   
  7.          "ODBC;" +   
  8.          "Driver={Sybase SQL Anywhere 5.0};" +   
  9.          "DefaultDir=c:\myfolder\;" +   
  10.          "Dbf=c:\mypath\dbname.db;" +   
  11.          "Uid=UserName;" +   
  12.          "Pwd=Secret;" +   
  13.          "Dsn="""";";     // Must be included!  
  14. conn.Open();   
  1. // OleDb -- Sybase Adaptive Server Enterprise (ASE)    
  2.  
  3. using System.Data.OleDb;  
  4.  
  5. OleDbConnection conn = new OleDbConnection();  
  6. conn.ConnectionString =   
  7.               "Driver=Sybase.ASEOLEDBProvider;" +   
  8.               "Server Name=ServerName,5000;" +   
  9.               "Initial Catalog=DataBaseName;" +   
  10.               "User id=UserName;" +   
  11.               "Password=Secret;";   
  12. conn.Open();  
  13.  
  14. // optionally, replace   
  15. // 'Server Name' with 'Srvr', and   
  16. // 'Initial Catalog' with 'Catalog'  
  17.    
  1. // .NET DataProvider from Sybase    
  2.  
  3. using Sybase.Data.AseClient;  
  4.  
  5. AseConnection conn = new AseConnection();  
  6. conn.ConnectionString =   
  7.               "Data Source=ServerName;" +   
  8.               "Initial Catalog=DataBaseName;" +   
  9.               "User id=UserName;" +   
  10.               "Password=Secret;";   
  11. conn.Open();   
posted on 2010-12-25 21:16  清清飞扬  阅读(6560)  评论(0编辑  收藏  举报