コード例 #1
0
        private static DbDataAdapter GetAdapter(ConnectionType connectionType, string connectionString, string sqlText, string[] parameterValues)
        {
            DbDataAdapter adapter = null;

            switch (connectionType)
            {
            case ConnectionType.SqlServer:
                adapter = new SqlDataAdapter();
                break;

            case ConnectionType.Odbc:
                adapter = new OdbcDataAdapter();
                break;

            case ConnectionType.OleDb:
                adapter = new OleDbDataAdapter();
                break;

            case ConnectionType.Oracle:
                adapter = new OracleDataAdapter();
                break;
            }

            adapter.SelectCommand = (DbCommand)DatabaseHelpers.CreateCommand(connectionType, connectionString, sqlText, parameterValues, 60);
            return(adapter);
        }