Beispiel #1
0
        public SybaseCommand(string commandText, SybaseConnection connection, SybaseTransaction 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 SybaseParameterCollection(this);
        }
Beispiel #2
0
 private SybaseCommand(string commandText, SybaseConnection connection, SybaseTransaction transaction, CommandType commandType, UpdateRowSource updatedRowSource, bool designTimeVisible, int commandTimeout, SybaseParameterCollection parameters)
 {
     this.commandText       = commandText;
     this.connection        = connection;
     this.transaction       = transaction;
     this.commandType       = commandType;
     this.updatedRowSource  = updatedRowSource;
     this.designTimeVisible = designTimeVisible;
     this.commandTimeout    = commandTimeout;
     this.parameters        = new SybaseParameterCollection(this);
     for (int i = 0; i < parameters.Count; i++)
     {
         this.parameters.Add(((ICloneable)parameters[i]).Clone());
     }
 }
Beispiel #3
0
        public SybaseTransaction BeginTransaction(IsolationLevel iso, string transactionName)
        {
            if (State == ConnectionState.Closed)
            {
                throw new InvalidOperationException("The connection is not open.");
            }
            if (Transaction != null)
            {
                throw new InvalidOperationException("SybaseConnection 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 SybaseTransaction(this, iso);
            return(transaction);
        }