IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

MFC Discussion :

controler le nombre d'enregistrement


Sujet :

MFC

  1. #1
    Membre à l'essai
    Inscrit en
    Janvier 2003
    Messages
    39
    Détails du profil
    Informations forums :
    Inscription : Janvier 2003
    Messages : 39
    Points : 18
    Points
    18
    Par défaut controler le nombre d'enregistrement
    Salut a tous,
    je manipule une bdd access, et j'aurais voulu savoir comment je recupere le nombre d'enregistrements que ma requette ma sorti.
    voici mon code

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    	CString req;
    	UpdateData(true);
    	req = "select login, password from titi where login='+m_login+' and password='+m_password+'";
    	UpdateData(false);
    merci d'avance

  2. #2
    Membre habitué Avatar de BertrandA
    Inscrit en
    Août 2003
    Messages
    170
    Détails du profil
    Informations forums :
    Inscription : Août 2003
    Messages : 170
    Points : 197
    Points
    197
    Par défaut
    Ca dépend de la technologie d'accès aux données, de l'utilisation ou non des MFC avec ces technologies et le code que tu donnes ne nous renseigne pas là dessus.

    DAO ? ODBC ? ADO ? Avec ou sans MFC ?...

  3. #3
    Membre à l'essai
    Inscrit en
    Janvier 2003
    Messages
    39
    Détails du profil
    Informations forums :
    Inscription : Janvier 2003
    Messages : 39
    Points : 18
    Points
    18
    Par défaut
    alors la connexion se fait en ODBC et j'utilise les mfc

  4. #4
    Membre habitué Avatar de BertrandA
    Inscrit en
    Août 2003
    Messages
    170
    Détails du profil
    Informations forums :
    Inscription : Août 2003
    Messages : 170
    Points : 197
    Points
    197
    Par défaut
    CRecordset::GetRecordCount()

  5. #5
    mat.M
    Invité(e)
    Par défaut
    SQLRowCount
    Conformance

    Version Introduced:ODBC 1.0
    Standards Compliance:ISO 92

    Summary

    SQLRowCount returns the number of rows affected by an UPDATE, INSERT, or DELETE statement, an SQL_ADD, SQL_UPDATE_BY_BOOKMARK, or SQL_DELETE_BY_BOOKMARK operation in SQLBulkOperations, or an SQL_UPDATE or SQL_DELETE operation in SQLSetPos.

    Syntax

    SQLRETURN SQLRowCount(
    SQLHSTMTStatementHandle,
    SQLINTEGER *RowCountPtr);

    Arguments

    StatementHandle

    [Input]
    Statement handle.

    RowCountPtr

    [Output]
    Points to a buffer in which to return a row count. For UPDATE, INSERT, and DELETE statements, for the SQL_ADD, SQL_UPDATE_BY_BOOKMARK, and SQL_DELETE_BY_BOOKMARK operations in SQLBulkOperations, and for the SQL_UPDATE or SQL_DELETE operations in SQLSetPos, the value returned in *RowCountPtr is the number of rows affected by the request or –1 if the number of affected rows is not available.

    When SQLExecute, SQLExecDirect, SQLBulkOperations, SQLSetPos, or SQLMoreResults is called, the SQL_DIAG_ROW_COUNT field of the diagnostic data structure is set to the row count, and the row count is cached in an implementation-dependent way. SQLRowCount returns the cached row count value. The cached row count value is valid until the statement handle is set back to the prepared or allocated state, the statement is reexecuted, or SQLCloseCursor is called. Note that if a function has been called since the SQL_DIAG_ROW_COUNT field was set, the value returned by SQLRowCount might be different from the value in the SQL_DIAG_ROW_COUNT field, because the SQL_DIAG_ROW_COUNT field is reset to 0 by any function call.

    For other statements and functions, the driver may define the value returned in *RowCountPtr. For example, some data sources may be able to return the number of rows returned by a SELECT statement or a catalog function before fetching the rows.

    Note Many data sources cannot return the number of rows in a result set before fetching them; for maximum interoperability, applications should not rely on this behavior.

    Returns

    SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.

    Diagnostics

    When SQLRowCount returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling SQLGetDiagRec with a HandleType of SQL_HANDLE_STMT and a Handle of StatementHandle. The following table lists the SQLSTATE values commonly returned by SQLRowCount and explains each one in the context of this function; the notation “(DM)” precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

    SQLSTATE Error Description
    01000 General warning Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)
    HY000 General error An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by SQLGetDiagRec in the *MessageText buffer describes the error and its cause.
    HY001 Memory allocation error The driver was unable to allocate memory required to support execution or completion of the function.
    HY010 Function sequence error (DM) The function was called prior to calling SQLExecute, SQLExecDirect, SQLBulkOperations, or SQLSetPos for the StatementHandle.
    (DM) An asynchronously executing function was called for the StatementHandle and was still executing when this function was called.

    (DM) SQLExecute, SQLExecDirect, SQLBulkOperations, or SQLSetPos was called for the StatementHandle and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.

    HY013 Memory management error The function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.
    HYT01 Connection timeout expired The connection timeout period expired before the data source responded to the request. The connection timeout period is set through SQLSetConnectAttr, SQL_ATTR_CONNECTION_TIMEOUT.
    IM001 Driver does not support this function (DM) The driver associated with the StatementHandle does not support the function.


    Comments

    If the last SQL statement executed on the statement handle was not an UPDATE, INSERT, or DELETE statement, or the Operation argument in the previous call to SQLBulkOperations was not SQL_ADD, SQL_UPDATE_BY_BOOKMARK, or SQL_DELETE_BY_BOOKMARK, or the Operation argument in the previous call to SQLSetPos was not SQL_UPDATE or SQL_DELETE, the value of *RowCountPtr is driver-defined. For more information, see “Determining the Number of Affected Rows” in Chapter 12, “Updating Data.”

    Related Functions

    Chercher dans les samples du MSDN il y a QuickView je crois qui est un générateur de requêtes SQL

    For information about See
    Executing an SQL statement SQLExecDirect
    Executing a prepared SQL statement SQLExecute

  6. #6
    mat.M
    Invité(e)
    Par défaut
    Citation Envoyé par BertrandA
    CRecordset::GetRecordCount()
    Non c'est DAO et DAO c'est obsolète

  7. #7
    Membre habitué Avatar de BertrandA
    Inscrit en
    Août 2003
    Messages
    170
    Détails du profil
    Informations forums :
    Inscription : Août 2003
    Messages : 170
    Points : 197
    Points
    197
    Par défaut
    CRecordset::GetRecordCount()
    Non c'est DAO et DAO c'est obsolète
    N'importe quoi !
    Les classes MFC DAO sont préfixées CDAO....
    CDatabase, CRecordset et CLongBinary constituent le support ODBC dans MFC :
    http://msdn.microsoft.com/library/de...28.odbc.29.asp

  8. #8
    mat.M
    Invité(e)
    Par défaut
    Bertrand on se calme et on boit frais
    De toute façon l'auteur ( Johnny ) répond aux abonnés absents alors

Discussions similaires

  1. nombre de controles par rapport au nombre d'enregistrements
    Par redstoff dans le forum Modélisation
    Réponses: 3
    Dernier message: 07/02/2012, 11h09
  2. [DB] Nombre d'enregistrements d'une table
    Par Mister Nono dans le forum Bases de données
    Réponses: 26
    Dernier message: 09/05/2006, 09h51
  3. [débutant] Limitation du nombre d'enregistrement renvoyé
    Par tmcgrady dans le forum Langage SQL
    Réponses: 4
    Dernier message: 12/11/2003, 09h41
  4. [PostgreSQL] Controle du nb d'enregistrements
    Par k-reen dans le forum Requêtes
    Réponses: 2
    Dernier message: 04/03/2003, 10h46
  5. XMLGram et nombre d'enregistrements par page
    Par Sylvain Leray dans le forum XMLRAD
    Réponses: 7
    Dernier message: 26/02/2003, 12h35

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo