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

asked 18 Oct, 14:52

Paula's gravatar image

Paula
1115611
accept rate: 0%


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

permanent link

answered 18 Oct, 15:44

Chris%20Keating's gravatar image

Chris Keating
3.2k1956
accept rate: 29%

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

(18 Oct, 16:50) Paula
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×146
×44

question asked: 18 Oct, 14:52

question was seen: 78 times

last updated: 18 Oct, 16:50