Couchbase N1QL with C# - Add values to listview


#1

Have a problem with adding values to listview in C#. Can’t find anything in SDK section about this. My setup Visual studio 2015 and Couchbase 4 RC0.

Example below just add test values and nothing more…

Code:

private void btn_submit_Click(object sender, EventArgs e)
{
    listView.Items.Clear();

    var cluster = new Cluster("couchbaseClients/couchbase");

    using (var bucket = cluster.OpenBucket("default", "**"))
    {
        var query = "SELECT ID, name FROM default";
        var queryRequest = new QueryRequest(query);

        var results = bucket.Query<dynamic>(queryRequest);

        if (results.Success)
        {
            // Add test values to listview
            ListViewItem i = new ListViewItem("test");
            i.SubItems.Add("test2");
            listView.Items.Add(i);

            foreach (var result in results.Rows)
            {
                // Add values from N1Q1 query
                ListViewItem item = new ListViewItem(result.ID);
                item.SubItems.Add(result.name);
                listView.Items.Add(item);
            }

        }
        else
        {
            MessageBox.Show("Error", "Error", MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
        }
    }
}

Anyone?


#2

@Johannes -

Is result.Success true? If not what is the value Status, Message and Exception fields?

-Jeff