Codesmith Unable to get Oracle table annotations

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.