public static void RunDataTableTest(MainForm frm) { PFOdbc db = new PFOdbc(); Program._messageLog.WriteLine("RunDataTableTest started ..."); try { db.ConnectionString = frm.cboConnectionString.Text; db.OpenConnection(); _msg.Length = 0; _msg.Append("Connection string is "); _msg.Append(db.ConnectionString); _msg.Append("\r\n"); _msg.Append("Connection state is "); _msg.Append(db.Connection.State.ToString()); _msg.Append("\r\n"); _msg.Append("Query text is:\r\n"); _msg.Append(frm.txtSqlQuery.Text.ToString()); Program._messageLog.WriteLine(_msg.ToString()); db.returnResult += new PFOdbc.ResultDelegate(OutputResults); db.SQLQuery = frm.txtSqlQuery.Text; db.CommandType = CommandType.Text; DataTable tab = db.RunQueryDataTable(); db.ProcessDataTable(tab); db.returnResult -= OutputResults; db.returnResultAsString += new PFOdbc.ResultAsStringDelegate(OutputResultsToFile); if (_textFile.FileIsOpen) { _textFile.CloseFile(); } _textFile.OpenFile(@"c:\temp\OdbcDtDelimited.txt", PFFileOpenOperation.OpenFileForWrite); tab = db.RunQueryDataTable(); db.ExtractDelimitedDataFromTable(tab, "\t", "\r\n", true); if (_textFile.FileIsOpen) { _textFile.CloseFile(); } _textFile.OpenFile(@"c:\temp\OdbcDtFixedLength.txt", PFFileOpenOperation.OpenFileForWrite); tab = db.RunQueryDataTable(); db.ExtractFixedLengthDataFromTable(tab, true, true, false); if (_textFile.FileIsOpen) { _textFile.CloseFile(); } tab = db.RunQueryDataTable(); tab.TableName = "TestTab007z"; db.SaveDataTableToXmlFile(tab, @"c:\temp\OdbcTestDt.xml"); tab = db.RunQueryDataTable(); db.SaveDataTableWithSchemaToXmlFile(tab, @"c:\temp\OdbcTestDtPlus.xml"); tab = db.RunQueryDataTable(); db.SaveDataTableToXmlSchemaFile(tab, @"c:\temp\OdbcTestDt.xsd"); tab = db.RunQueryDataTable(); PFDataProcessor dataProcessor = new PFDataProcessor(); tab.TableName = "TestTab001x"; XmlDocument xmlDoc = dataProcessor.CopyDataTableToXmlDocument(tab); Program._messageLog.WriteLine("\r\n" + xmlDoc.OuterXml + "\r\n"); } catch (System.Exception ex) { _msg.Length = 0; _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex)); Program._messageLog.WriteLine(_msg.ToString()); AppMessages.DisplayErrorMessage(_msg.ToString(), _saveErrorMessagesToAppLog); } finally { if (_textFile.FileIsOpen) { _textFile.CloseFile(); } if (db.Connection.State == ConnectionState.Open) { db.CloseConnection(); } Program._messageLog.WriteLine("... RunDataTableTest finished."); } }