Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hi,

ich habe eine Access Tabelle mit 5 Datensätzen. Mein Programm soll diese auslesen

und in Variablen speichern, komischerweise wird immer nur ein Datensatz im

Recordset gespeichert und ich habe keine Ahnung warum, ihr vieleicht?


HRESULT Dokus()
{
char sqltemp[500],
szFehler[150];
CString strValue;
CRecordset Record(&g_.Datenquelle);

sprintf (sqltemp,"SELECT * FROM %s",Info.strDoku);

try
{
Record.Open(CRecordset::snapshot,sqltemp,CRecordset::none);
}
catch(CDBException dbex)
{
strcpy(szFehler,"F#Ein unbekannter Fehler ist aufgetreten.");
send(g_.ClientSocket,szFehler,strlen(szFehler),NULL);
dbex.ReportError();
return -1;
}

try
{
Info.iAnzahlDokus = Record.GetRecordCount();
_CrtDbgReport(_CRT_ASSERT,"fth",4,"fgngzj","anz = %i",Info.iAnzahlDokus);
if (Info.iAnzahlDokus > 0)
{
Info.strDokuname = new CString[Info.iAnzahlDokus];
Info.strDokupfad = new CString[Info.iAnzahlDokus];

//Record.MoveFirst();
for (int i=0; i<Info.iAnzahlDokus; i++)
{
Record.GetFieldValue(1,Info.strDokuname[i]);
Record.GetFieldValue(2,Info.strDokupfad[i]);
if (i < Info.iAnzahlDokus-1)
Record.MoveNext();
}
Info.bDokus = true;
}
return 1;
}
catch(CDBException dbex)
{
strcpy(szFehler,"F#Ein unbekannter Fehler ist aufgetreten.");
send(g_.ClientSocket,szFehler,strlen(szFehler),NULL);
dbex.ReportError();
return -1;
}
return 0;
}
[/PHP]

Gruß

Guybrush

Ach Guybrush....du weisst doch...Brille aufsetzen und MSDN lesen :D

Caution   The record count is maintained as a “high water mark†— the 
highest-numbered record yet seen as the user moves through the records. The total
number of records is only known after the user has moved beyond the last record.
For performance reasons, the count is not updated when you call MoveLast. To count
the records yourself, call MoveNext repeatedly until IsEOF returns nonzero. Adding a
record via CRecordset:AddNew and Update increases the count; deleting a record via
CRecordset::Delete decreases the count.
[/PHP]

Goos

Naja fuer deine Zwecke braucht man das GetRecordCount() auf jeden Fall eher nicht so. Ich kenne aber ausser dir auch niemandend der alle Datensaetze auf einmal auslesen will, da dass ja in der Regel eher elfundneunzigtausend Datensaetze sind und nicht nur fuenf wie in deinem Fall.

...ach und das mit der Brille: Ich hab irgendwann mal gehoert, dass jeder zweite ne Brille hat....da ich aber nun mal ausser der Sonnenbrille keine eigene besitze....usw

:D

Goos

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.