- Gary Herrault
- .NET DataStore
- Thursday, 22 September 2022 07:49 PM UTC
Hi. I'm looking for a way in my web api to obtain the column data types from a sql select statement. I am currently trying to use datastore.Describe( colName.ColType ) which returns "System.String" and "System.Decimal" without the length of the string and precision of the decimal. Is there some other datastore property I can use with the Describe method in order to obtain these values?
using PowerScript.Bridge;
var dwMeta = DwMeta.CreateFromSql(sqlSelect, _dataContext);
IDataStore ds = DataStore.Create(dwMeta, _dataContext);
int columnCount = int.Parse(ds.Describe("Datawindow.Column.Count"));
for (int colNo = 1; colNo <= columnCount ; colNo++)
{
string colName = ds.Describe("#" + (colNo - 1) + ".Name");
string colType = ds.Describe(colName + ".ColType");
}
Thanks.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.