Exemplo n.º 1
0
        public PqsqlDataAdapter(string selectCommandText, PqsqlConnection selectConnection)
        {
            PqsqlCommand cmd = null;

            try
            {
                cmd           = new PqsqlCommand(selectCommandText, selectConnection);
                SelectCommand = cmd;

                cmd = null;
            }
            finally
            {
                cmd?.Dispose();
            }
        }
Exemplo n.º 2
0
        public PqsqlDataAdapter(string selectCommandText, string selectConnectionString)
        {
#if CODECONTRACTS
            Contract.Requires <ArgumentNullException>(selectCommandText != null);
            Contract.Requires <ArgumentNullException>(selectConnectionString != null);
#else
            if (selectCommandText == null)
            {
                throw new ArgumentNullException(nameof(selectCommandText));
            }
            if (selectConnectionString == null)
            {
                throw new ArgumentNullException(nameof(selectConnectionString));
            }
#endif

            PqsqlConnection conn = null;
            PqsqlCommand    cmd  = null;

            try
            {
                conn = new PqsqlConnection(selectConnectionString);

                // ReSharper disable once UseObjectOrCollectionInitializer
                cmd             = new PqsqlCommand();
                cmd.CommandText = selectCommandText;
                cmd.Connection  = conn;

                SelectCommand = cmd;

                cmd  = null;
                conn = null;
            }
            finally
            {
                cmd?.Dispose();
                conn?.Dispose();
            }
        }