Raja,
It worked with some modification to take into account the fact that I am doing some funky inheritance. The code is living in my MSAccess/SQLite database viewer available at:
http://sourceforge.net/projects/plane-disaster/.
Its in the SVN repo. I will probably release a new version soon.
/// <summary>
/// Gets the SQL executed by a given TABLE.
/// </summary>
/// <remarks>
/// Posted by Rasha in http://sqlite.phxsoftware.com/forums/thread/2272.aspx
/// </remarks>
/// <returns>
/// The DDL of the given table.
/// </returns>
public virtual string GetTableSQL(string Table) {
using (SQLiteCommand cmd = (SQLiteCommand)Cn.CreateCommand()) {
cmd.CommandText = "SELECT sql FROM sqlite_master " +
"WHERE name = @tablename";
cmd.Parameters.Add("@tablename", DbType.String);
cmd.Parameters["@tablename"].Value = Table;
return (string) cmd.ExecuteScalar();
}
}