ListView with WPF in Visual Cobol


I am a new member and i try use a listview in a program.

I've seen many examples but I haven't been able to put any working. I have always a problem.

The las problem is an incompatibility with de SETTER and GETTER use with a $SET SQL(ODBC=DBMAN). When i can put the listview working i add the directive $SET SQL(ODBC=DBMAN) and the complier send me the error "Error 3 COBCH0002 : Undefined ECM error. Inform Technical Support. Error code 12"

If anyone can send me a simple complete example would really help.

I wont tu use de listview with a MySql database.


  • Verified Answer

    The SQL directive that you are using is invalid as it should be $SET SQL(DBMAN=ADO) for managed code .NET applications and not ODBC (you also have the directive/value in wrong order)

    For MySQL you cannot use the ADO Connection Editor to create a named connection because the MySQL provider does not return information in the format that we require.

    You can however connect to the ADO provider using a connect string.


    exec sql

      connect using



  • Thanks for your help. You resolve my problem (the directive in wrong order is a error in the post)..

    Now i have a little problem: when i select a row of the listview i how can i get selected data?

  • Verified Answer

    You can use the event SelectionChanged to find out what the current selected value is either by its index number within the ListView or you can retrieve the selected item into an object of the same type.


    method-id listView1_SelectionChanged final private.

          procedure division using by value sender as object e as type System.Windows.Controls.SelectionChangedEventArgs.

              *> Get index value

              set selectedRow to ListView1::SelectedIndex  

              *> Get the select row into an object of the same type          

              declare rowvalue as type CustData.CustData = listView1::SelectedItem as type CustData.CustData