cancel
Showing results for 
Search instead for 
Did you mean: 

Ultralite for WinRT API ResultSetSchema

0 Kudos
2,061

Hello,

I am converting our existing .NET ultralite based app to run on UWP. I am just learning the Ultralite for WinRT API...so please forgive this very basic question!

I am using version 17 developer edition of SQL Anywhere and Visual Studio 2017. I am using the SAP Docs to learn the API.

I am able to connect to a database and select data from a table into a ResultSet object. I am attempting to get the column names using a ResultSetSchema object. The call I'm using (GetColumnName) always returns an empty string.

Does this not work or is there something else I need to do? Or maybe it does not work like I think it works?

Here's a snip of code I'm using - again, very basic:

DatabaseManager.Init(); Connection connection = DatabaseManager.OpenConnection(connParms); PreparedStatement ps = connection.PrepareStatement("SELECT MyColOne, MyColTwo, MyColThree FROM MyTable"); try { ResultSet rs = ps.ExecuteQuery(); ResultSetSchema rsc = rs.GetResultSetSchema(); for (ushort i = 0; i < rsc.GetColumnCount(); i++) { ushort p = rsc.GetColumnType(i); string colName = rsc.GetColumnName(i, p); } }...

Thanks for the help!

Paula

Accepted Solutions (1)

Accepted Solutions (1)

chris_keating
Product and Topic Expert
Product and Topic Expert

The second parameter is a value from the ColumnNameType enumeration not the column type. The column name types are documented here:

http://dcx.sap.com/index.html#sqla17api/en/html/82669a9a6ce210149dd4ad0a20171b83.html

0 Kudos

Thank you! I just assumed type was the type of the column. Works like a charm.

Answers (0)