Hi all, whaz up

poeple i have a little problem!
if anybody could help me, i would be grateful


i have made an application in borland c++ about credit cards
there are 2 fields, and between them are 2 buttons (import and status)
when i press the import button, i choose the place from where i wanna get
the files in the first field.
Only specific files can be imported (PAN's - long numbers)
so when the numbers are on the first field, i have to press the second
button the satus button, so the PAN's would go to the other field
but ordered by min/max value.
In the first field they are ordered from the minimum to the maximum.

So where is the problem you ask? Well i wanna put this code:

select ncrd,tcrnacrd, nbrn from =gcard where ncrd in
("6770320004869316",
"6770320004870710",
"6770320004873417",
"6770320004873516") - EXAMPLES of PAN's

order by PAN_INDEX_RANGE_ID, NBRN, NCRD;


into the main code, or somewhere there, so i can order the PAN's in the
SECOND field by NBRN - branches.
Could anybody help me.
Here is the main code:

if(fileRecCount<1)
    {
        ShowMessage("No records");
        return;
    }
    PinPrintControl->BeginTrans();
    dbRecCount =0;
    int errRows = 0;
    AnsiString tmpStr;

    statusGrid->Cols[0]->Clear();
    statusGrid->Cols[1]->Clear();
    int row=0;
    int a=0;
    statusGrid->RowCount=0;

    for (int i=0; i<cardsGrid->RowCount; i++)
    {
        PinQuery->Active = false;
        PinQuery->SQL->Clear();
        tmpStr="SELECT ncrd, cisspcrd FROM GCARD WHERE";
        tmpStr = tmpStr + " ncrd = '" + cardsGrid->Cells[0][i] + "'";
        PinQuery->SQL->Add(tmpStr);
        PinQuery->Active = true;
        PinQuery->First();

        if (!(PinQuery->Eof && PinQuery->Bof))
        {
            dbRecCount++;
            statusGrid->Cells[1][row] = PinQuery->FieldByName("cisspcrd")->AsString;
            statusGrid->Cells[0][row] = PinQuery->FieldByName("ncrd")->AsString.Trim();

            if (statusGrid->Cells[0][row]!="")
            {
                statusGrid->Refresh();
                row++;
                statusGrid->RowCount++;
            }
            else
            {
                statusGrid->RowCount--;
                row--;
                statusGrid->Refresh();
            }
        }
        else if (PinQuery->Eof && PinQuery->Bof)
        {
            statusGrid->Cells[0][row] = "There is not such a PAN!!";

            if (statusGrid->Cells[0][row]!="")
            {
                statusGrid->Refresh();
                statusGrid->RowCount++;
                row++;
            }
            else
            {
                statusGrid->RowCount--;
                row--;
                statusGrid->Refresh();
            }
        }
    }

    statusGrid->RowCount = row;
    status->Panels->Items[2]->Text = "Numbers of cards in base: " + IntToStr(dbRecCount);
    status->Panels->Items[1]->Text = "Mistakes: " + IntToStr(errRows);

    if(fileRecCount==dbRecCount)
    {
        minRow->Enabled=true;
        maxRow->Enabled=true;
        minRow->MaxValue = statusGrid->RowCount+1;
        maxRow->MaxValue = statusGrid->RowCount;
    }else
    {
        minRow->Enabled=false;
        maxRow->Enabled=false;
        minRow->MaxValue = 1;
        maxRow->MaxValue = 0;
        ShowMessage("different numbers of cards in the base and in R*");
    }
    PinQuery->Active = false;
    PinPrintControl->CommitTrans();

---------------------------------------------------------------
Anybody, please

thanks
best regards

Member Avatar for jencas

Use your ddebugger to watch the content of tmpStr in this for loop:

for (int i=0; i<cardsGrid->RowCount; i++)

After that you should know what to do!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.