Exemplo n.º 1
0
 public ADODB.Recordset Recordset(string sql, ADODB.CursorTypeEnum openType, ADODB.LockTypeEnum lockType)
 {
     try
     {
         if (_connection.State == 0 && Account != null)
         {
             _connection.Open(UserID: Account.LogonID, Password: Account.Password);
         }
         ADODB.Recordset rs = new ADODB.Recordset();
         rs.Open(sql, this.Connection, openType, lockType);
         return(rs);
     }
     catch (Exception) { return(null); }
 }
Exemplo n.º 2
0
    public static bool OpenAdoRec_R(ADODB.Connection globaldb, ADODB.Recordset rec, string connectionString, ADODB.CursorTypeEnum typelink)
    {
        bool opened;

        CloseAdoRec(rec);
        try
        {
            // Open table.
            rec.CursorType = typelink; // ADODB.CursorTypeEnum.adOpenDynamic; // all types of movement through Recordset are allowed
            rec.LockType   = ADODB.LockTypeEnum.adLockPessimistic;
            rec.Open(connectionString, globaldb);
            opened = true;
        }
        catch (Exception ex)
        {
            // MyUtilities.MsgBox("Error in opening recordset.");
            opened = false;
            //throw new Exception(ex.Message);
        }
        // Response.Write(opened); - for debugging purposes
        return(opened);
    }