DataConnector
ADO.NET provider for Kintone / Schema Details
In This Topic
    Schema Details
    In This Topic

    The ADO.NET provider for Kintone supports schema discovery using ADO.NET classes or SQL statements to the system tables. The ADO.NET classes enable access to schema information of database, connection property and columns returned.

    GetSchema method of C1KintoneConnection class is used to retrieve schema of the Database and DataTables. 

    In the below code example GetSchema method is called which returns Tables in the Database. In the second call, the method returns the columns in a specific data table.

    C#
    Copy Code
    const string Username = "*******";
    const string Password = "*********";
    const string Url = "https://xg0w2.kintone.com";
    
    static string kintoneConnection = string.Format("Username={0};Password={1};Url={2}", Username, Password, Url);
    static void Main(string[] args)
    {
        using (C1KintoneConnection connection = new C1KintoneConnection(kintoneConnection))
        {
            connection.Open();
            //Get list of tables
            DataTable databaseTables = connection.GetSchema("Tables");
            Console.WriteLine("List of Tables in database:");
            foreach (DataRow row in databaseTables.Rows)
            {
                //Display Tablename
                Console.WriteLine(row["TableName"]);
            }
            //Get column names in a table
            DataTable datatableColumns = connection.GetSchema("Columns", new string[] { "Products" });
            Console.WriteLine("\n Products Table columns:");
            foreach (DataRow column in datatableColumns.Rows)
            {
                //Display column properties                  
                Console.Write(column["ColumnName"]);
                Console.Write("\t" + column["DataType"]);                    
            }
        }