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 33 34
|
char buffer [5000];
{ // so the recordset is destroyed
CSQLRecordset rs( db );
rs << "select REP_ALIAS, DOC_ID, DOC_LASTFIRST,"
" SEGMENT, BRICK from M_TODOIO";
rs.SetWhere( "REP_ALIAS < 'ZZ'" ); // lt 1 screen full
rs.SQLExecDirect();
//init
count=0;
output=fopen (fileName,"w");
buffer[0]=NULL;
while ( rs.SQLFetch() )
{
int n = 1; // order is crucial; hence, the ctr
string sREP_ALIAS = rs.SQLGetData( n++ );
string sDOC_ID = rs.SQLGetData( n++ );
string sDOC_LASTFIRST = rs.SQLGetData( n++ );
string sSEGMENT = rs.SQLGetData( n++ );
string sBRICK = rs.SQLGetData( n++ );
count+=1;
cout << sREP_ALIAS << ","
<< sDOC_ID << ","
<< sDOC_LASTFIRST << ","
<< sSEGMENT << ","
<< sBRICK
<< endl; // ceci "imprime" sans problème
strcpy(buffer,sREP_ALIAS); // cette conversion se plante avec le message ci dessus ! |