C#資料庫連線字串——Visual FoxPro
阿新 • • 發佈:2019-01-28
- ODBC DSN
- ODBC without DSN -- Database container (dbc)
- ODBC without DSN -- Free table directory
- OleDb -- Database container (dbc)
- OleDb -- Free table directory
- // ODBC DSN
- using System.Data.Odbc;
- OdbcConnection conn = new OdbcConnection();
- conn.ConnectionString = "Dsn=DsnName";
- conn.Open();
- // ODBC without DSN -- Database container (dbc)
- using System.Data.Odbc;
- OdbcConnection conn = new OdbcConnection();
- conn.ConnectionString =
- "Driver={Microsoft Visual FoxPro Driver};" +
- "SourceType=DBC;" +
- "SourceDB=C:/MyPath/MyDb.dbc;" +
- "Exclusive=No";
- conn.Open();
- // ODBC without DSN -- Free table directory
- using System.Data.Odbc;
- OdbcConnection conn = new OdbcConnection();
- conn.ConnectionString =
- "Driver={Microsoft Visual FoxPro Driver};" +
- "SourceType=DBF;" +
- "SourceDB=C:/MyPath;" +
- "Exclusive=No";
- conn.Open();
- // OleDb -- Database container (dbc)
- using System.Data.OleDb;
- OleDbConnection conn =
- conn.ConnectionString =
- "Driver=VFPOLEDB;" +
- "Data Source=C:/MyPath/MyDb.dbc;" +
- "Collating Sequence=machine;" +
- "Password=Secret;";
- conn.Open();
- // OleDb -- Free table directory
- using System.Data.OleDb;
- OleDbConnection conn = new OleDbConnection();
- conn.ConnectionString =
- "Driver=VFPOLEDB;" +
- "Data Source=C:/MyPath/;" +
- "Collating Sequence=general;" +
- "Password=Secret;";
- conn.Open();