//ODBC接続文字列を組み立てる
OdbcConnectionStringBuilder builder = new OdbcConnectionStringBuilder();
builder["Driver"] = "Microsoft Text Driver (*.txt; *.csv)";
builder["dbq"] = csvDir;
builder["Extension"] = "asc,csv,tab,txt";
using (OdbcConnection con = new OdbcConnection(builder.ConnectionString)){
//SQLの実行
}
OdbcConnectionStringBuilder builder = new OdbcConnectionStringBuilder();
builder["Driver"] = "Microsoft Text Driver (*.txt; *.csv)";
builder["dbq"] = csvDir;
builder["Extension"] = "asc,csv,tab,txt";
using (OdbcConnection con = new OdbcConnection(builder.ConnectionString)){
//SQLの実行
}
ほかにもSQLConnectionStringBuilder(SQLServer用)や抽象クラスDbConnectionStringBuilderが存在します。
0 件のコメント:
コメントを投稿