public TdsCommand (string commandText, TdsConnection connection, TdsTransaction transaction) 
		{
			this.commandText = commandText;
			this.connection = connection;
			this.transaction = transaction;
			this.commandType = CommandType.Text;
			this.updatedRowSource = UpdateRowSource.Both;

			this.designTimeVisible = false;
			this.commandTimeout = 30;
			parameters = new TdsParameterCollection (this);
		}
Exemple #2
0
        public TdsCommand(string commandText, TdsConnection connection, TdsTransaction transaction)
        {
            this.commandText      = commandText;
            this.connection       = connection;
            this.transaction      = transaction;
            this.commandType      = CommandType.Text;
            this.updatedRowSource = UpdateRowSource.Both;

            this.designTimeVisible = false;
            this.commandTimeout    = 30;
            parameters             = new TdsParameterCollection(this);
        }
Exemple #3
0
        public TdsTransaction BeginTransaction(IsolationLevel iso, string transactionName)
        {
            if (State == ConnectionState.Closed)
            {
                throw new InvalidOperationException("The connection is not open.");
            }
            if (Transaction != null)
            {
                throw new InvalidOperationException("TdsConnection does not support parallel transactions.");
            }

            string isolevel = String.Empty;

            switch (iso)
            {
            case IsolationLevel.Chaos:
                isolevel = "CHAOS";
                break;

            case IsolationLevel.ReadCommitted:
                isolevel = "READ COMMITTED";
                break;

            case IsolationLevel.ReadUncommitted:
                isolevel = "READ UNCOMMITTED";
                break;

            case IsolationLevel.RepeatableRead:
                isolevel = "REPEATABLE READ";
                break;

            case IsolationLevel.Serializable:
                isolevel = "SERIALIZABLE";
                break;
            }

            tds.Execute(String.Format("SET TRANSACTION ISOLATION LEVEL {0}\nBEGIN TRANSACTION {1}", isolevel, transactionName));
            transaction = new TdsTransaction(this, iso);
            return(transaction);
        }
		public TdsTransaction BeginTransaction (IsolationLevel iso, string transactionName)
		{
			if (State == ConnectionState.Closed)
				throw new InvalidOperationException ("The connection is not open.");
			if (Transaction != null)
				throw new InvalidOperationException ("TdsConnection does not support parallel transactions.");

			string isolevel = String.Empty;
			switch (iso) {
			case IsolationLevel.Chaos:
				isolevel = "CHAOS";
				break;
			case IsolationLevel.ReadCommitted:
				isolevel = "READ COMMITTED";
				break;
			case IsolationLevel.ReadUncommitted:
				isolevel = "READ UNCOMMITTED";
				break;
			case IsolationLevel.RepeatableRead:
				isolevel = "REPEATABLE READ";
				break;
			case IsolationLevel.Serializable:
				isolevel = "SERIALIZABLE";
				break;
			}

			tds.Execute (String.Format ("SET TRANSACTION ISOLATION LEVEL {0}\nBEGIN TRANSACTION {1}", isolevel, transactionName));
			transaction = new TdsTransaction (this, iso);
			return transaction;
		}