If you install the CodeSmith5.2 version, SQL Server does not have any problems, and Oracle can only get comments from the column and not get the table comments, after looking for data in many ways, find the most important solution, SQL statement, as follows:
SELECT * FROM User_tab_comments
The purpose of this SQL statement is to query all the tables in the system for comments, and we only need to join the criteria to query the comments, the code is as follows:
//get notes for the table, Oracle dedicated Public stringgettabledescription () {stringresult=""; using(OracleConnection conn =NewOracleConnection ( This. SourceTable.Database.ConnectionString)) {OracleCommand Comm=NewOracleCommand ("Select Comments from user_tab_comments where Table_name= '"+ This. sourcetable.name+"'", conn); Conn. Open (); Result=convert.tostring (comm. ExecuteScalar ()); Comm. Dispose (); Conn. Close (); } returnresult;}
Of course, if this codesmith will be an error, then we need to reference the assembly and namespace in the header as follows:
<%--The following is a reference assembly--%><%@ Assembly Name="System.Data.OracleClient" %><%--here is the reference namespace--%><%@ Import Namespace="System.Data.OracleClient" %>
You can get a comment by using the Gettabledescription () method as you walk here.
Note: SourceTable represents the table variable defined by the header, as follows:
<%@ PropertyName="SourceTable"Type="Schemaexplorer.tableschema"Category="Context"Description="Select a table for the database" %>
Hopefully this record will also give you the inspiration for the urgent need to solve the problem.
Codesmith Unable to get Oracle table annotations