I think it's pretty simple. Ignore .sch files which already exist in that example. In OpenDB() comment everything which is after //schema line (only return true should stay there). Somewhere in your program use
SaveFile("filename", ExportSch(m_session, "test"));
// or
SaveFile("filename", ExportSch("test"));
// you may also assign content returned by ExportSch to a Upp control