UPDATE..
I made a few changes to the code to test where the error is from:
int write_wks_to_db(){
Worksheet wks = Project.ActiveLayer();
if ( !wks )
return 5;
//connect to database "Analysis" on "Lintilla"
string strConn = STR_DB_CONN;
string strQuery = STR_QUERY;
Object oConn;
oConn = CreateObject("ADODB.Connection");
if ( !oConn )
return 4;
oConn.Open(strConn);
Object oRecordset;
oRecordset = CreateObject("ADODB.Recordset");
if ( !oRecordset )
return 3;
//open recordset
oRecordset.CursorLocation = 3; //adUseClient, please refer to MSDN for details
oRecordset.Open(strQuery, oConn, 1, 3); //adOpenKeyset, adLockOptimistic
int iRowBegin = 0, nRows = 4; //8 rows
int iColBegin = 0, nCols = 8; //9 columns
//LAYWKSETRECORDSET_APPEND for appending new recordset;
//LAYWKSETRECORDSET_REPLACE for replacing existing recordsets.
int nOption = LAYWKSETRECORDSET_APPEND; //append.
int nRet = wks.WriteRecordset(oRecordset, nOption,
iRowBegin, nRows, iColBegin, nCols);
return (0==nRet);
}
And get the following error message when i run it.
quote:
Multiple-step operation generated errors. Check each status value.
How can I solve this?
such coding! much wow!