Share via


Programatically reading data from AxDataSourceControl

DataSourceControl makes it simple to get Ax data and display it in DataBound UI controls and manipulate the data. You can also use them to read data programtically. Below is one way of doing it. The other way to get Ax data programatically is to get the DataSet directly using MetaDataCahce object and reading data.

 

private void GetData()

      {

            DataSourceViewSelectCallback callback = new DataSourceViewSelectCallback(PrintData);

              AxDataSource1.GetDataSourceView("CustTable").Select(DataSourceSelectArguments.Empty,callback);

   

      }

    private void PrintData(IEnumerable data)

    {

        IEnumerator i = data.GetEnumerator();

        while (i.MoveNext())

        {

            Response.Write(DataBinder.Eval(i.Current, "AccountNum").ToString() + “<BR/>”);

        }

    }

Comments