je voudrais associer une base de données de type access 2000 à un dbgrid
table mesures
champ : température,pression,...
merci d'avance c pour mon projet
je voudrais associer une base de données de type access 2000 à un dbgrid
table mesures
champ : température,pression,...
merci d'avance c pour mon projet
Est-ce que cela doit être absolumenet un DBGrid, car si tu veux utiliser un MSFlexGrid, là je peux t'aider.
comment on fait avec un flex grid control ?
L'exemple que je te donne est basé sur l'utilisation de la librairie ADOLib.
J'espère que cela pourra un petit peu t'aider.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 if (!mySel.Open(myConn->ADOConn, "select * from boitiers")){ cout << mySel.GetError() << endl; // Affichage de l'erreur } else { int iRec = 0; CString sTemp; iRec = 2; m_FlexGrid.SetCols(mySel.GetColCount() + 1); for (int iCol = 0; iCol < mySel.GetColCount(); iCol++) { m_FlexGrid.SetRow(0); m_FlexGrid.SetCol(iCol+1); m_FlexGrid.SetText(mySel.GetFieldName(iCol)); } while (mySel.Fetch()) { CString sField; m_FlexGrid.SetRows(iRec); m_FlexGrid.SetRow(iRec-1); m_FlexGrid.SetRow(m_FlexGrid.GetRow()); m_FlexGrid.SetCol(0); sTemp.Format("%d", iRec-1); m_FlexGrid.SetText(sTemp); for (int iCol = 0; iCol < mySel.GetColCount(); iCol++) { m_FlexGrid.SetCol(iCol + 1); mySel.GetFieldVal(iCol, sField); m_FlexGrid.SetText(sField); } iRec++; } mySel.Close(); }
Bien à toi,
Partager