After fetching the database tables from DB, to get the columns descriptions associated with DB Table - uses following Query:
"sysTypes.name AS DataType, "+
"sysColumns.Length AS Length, " +
"sysColumns.Status AS Status " +
"FROM sysColumns, sysTypes " +
"WHERE sysColumns.id = " + {table_name}+
" AND sysColumns.usertype = sysTypes.usertype";
Costruct the column information and Make Word Table format and write into the document.
And close the database connection
How to use the Word,Document classes:
Add the following references -
---- Microsoft Office 10.0 Object Library
---- Microsoft Word 10.0 Object Library
Word._Application word = null;
Word._Document doc = null;
doc = word.Documents.Add(ref missing,ref missing,ref missing, ref missing);
doc.SaveAs(ref file,ref missing,ref missing,ref missing,ref missing,ref missing,
ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,
ref missing,ref missing,ref missing,ref missing);
doc = word.Documents.Open(ref file,ref missing,ref missing,ref missing,ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref falseValue, ref missing,ref missing,ref missing);
doc.Activate();