Custom Table GridView

vikas Kumar asked on November 11, 2020 17:08

I want to return the data from the custom table, I have written some code but doesn't work, anyone please help me, Thank you. string tableName = "customtable.CrudTable"; DataClassInfo dataTable = DataClassInfoProvider.GetDataClassInfo(tableName);

        if (dataTable != null)

        {
           // DataSet ds = CMS.CustomTables.CustomTableItemProvider.GetItems("SELECT * FROM customtable_CrudTable").Tables[;
            DataTable ds= CustomTableItemProvider.GetItems("SELECT * FROM customtable_CrudTable").Tables[0];

            gvCustomData.DataSource = ds;
            gvCustomData.DataBind();

        }

Correct Answer

Brenden Kehren answered on November 11, 2020 17:57

I'd suggest checking out the API Examples to find this info. You need to specify the classname of the custom table and not the actual query. If you want to use your own SQL query vs. the API to generate the query, then you need to use the ConnectionHelper.ExecuteQuery() method. You can see an example on this post.

0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.