Hi,
I can prepare a XML from a database table as shown below. Is there a way to write XML data to a database table easily (like deserialization in C#)?
// Prepare XML from database table
Private int xmlSample_buildXMLFragmentFromSQLAndTableName ( MSWChar *pwszLargeString, char *sqlStatement, char *tableName ) { char xmlBuffer[10000]; //make some big buffer to spill the text into while I build the fragment? long cursorID; MS_sqlda rowData; char tmpBuffer[1000]; int i; int status; mdlDB_openCursorWithID (&cursorID,sqlStatement); status = mdlDB_fetchRowByID (&rowData,cursorID); mdlDB_closeCursorByID (cursorID); //need to build the XML fragment to go here sprintf (xmlBuffer,"<%s>\n",tableName); //start the section for (i=0;i<rowData.numColumns ;i++ ) { char *escapedString = xmlSample_escapeStringForXML(rowData.value[i]); _snprintf (tmpBuffer,1000,"<%s>%s</%s>\n",rowData.name[i],escapedString,rowData.name[i]); free (escapedString); strcat (xmlBuffer,tmpBuffer); } _snprintf (tmpBuffer,1000,"</%s>\n",tableName);//end the section strcat (xmlBuffer,tmpBuffer); //put the xml fragment into an elmdscr? mdlCnv_convertMultibyteToUnicode (xmlBuffer,-1,pwszLargeString,5000);//convert to unicode #if defined (DEBUG) //debug code printf ("%S\n",pwszLargeString); #endif mdlDB_freeSQLDADescriptor (&rowData); return SUCCESS; }