C#数据库连接字符串——Sybase
- ODBC DSN
- ODBC -- Sybase System 12 (12.5) ODBC Driver
- ODBC -- Sybase System 11 ODBC Driver
- ODBC -- Intersolv 3.10 ODBC Driver
- ODBC -- SQL Anywhere
- OleDb -- Sybase Adaptive Server Enterprise (ASE)
- .NET DataProvider from Sybase
- // ODBC DSN
- using System.Data.Odbc;
- OdbcConnection conn = new OdbcConnection();
- conn.ConnectionString =
- "Dsn=DsnName;" +
- "Uid=UserName;" +
- "Pwd=Secret;";
- conn.Open();
- // ODBC -- Sybase System 12 (12.5) ODBC Driver
- using System.Data.Odbc;
- OdbcConnection conn = new OdbcConnection();
- conn.ConnectionString =
- "Driver={SYBASE ASE ODBC Driver};" +
- "Srvr=ServerName;" +
- "Uid=UserName;" +
- "Pwd=Secret;";
- conn.Open();
- // ODBC -- Sybase System 11 ODBC Driver
- using System.Data.Odbc;
- OdbcConnection conn = new OdbcConnection();
- conn.ConnectionString =
- "Driver={SYBASE SYSTEM 11};" +
- "Srvr=ServerName;" +
- "Uid=UserName;" +
- "Pwd=Secret;";
- conn.Open();
- // ODBC -- Intersolv 3.10 ODBC Driver
- using System.Data.Odbc;
- OdbcConnection conn = new OdbcConnection();
- conn.ConnectionString =
- "Driver={INTERSOLV 3.10 32-BIT Sybase};" +
- "Srvr=ServerName;" +
- "Uid=UserName;" +
- "Pwd=Secret;";
- conn.Open();
- // ODBC -- SQL Anywhere
- using System.Data.Odbc;
- OdbcConnection conn = new OdbcConnection();
- conn.ConnectionString =
- "ODBC;" +
- "Driver={Sybase SQL Anywhere 5.0};" +
- "DefaultDir=c:\myfolder\;" +
- "Dbf=c:\mypath\dbname.db;" +
- "Uid=UserName;" +
- "Pwd=Secret;" +
- "Dsn="""";"; // Must be included!
- conn.Open();
- // OleDb -- Sybase Adaptive Server Enterprise (ASE)
- using System.Data.OleDb;
- OleDbConnection conn = new OleDbConnection();
- conn.ConnectionString =
- "Driver=Sybase.ASEOLEDBProvider;" +
- "Server Name=ServerName,5000;" +
- "Initial Catalog=DataBaseName;" +
- "User id=UserName;" +
- "Password=Secret;";
- conn.Open();
- // optionally, replace
- // 'Server Name' with 'Srvr', and
- // 'Initial Catalog' with 'Catalog'
- // .NET DataProvider from Sybase
- using Sybase.Data.AseClient;
- AseConnection conn = new AseConnection();
- conn.ConnectionString =
- "Data Source=ServerName;" +
- "Initial Catalog=DataBaseName;" +
- "User id=UserName;" +
- "Password=Secret;";
- conn.Open();