Highlighted
Outstanding Contributor.
Outstanding Contributor.
1943 views

ListView with WPF in Visual Cobol

Jump to solution

Hello:

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.

Thanks.

0 Likes
2 Solutions

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: ListView with WPF in Visual Cobol

Jump to solution

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.

Example:

exec sql

  connect using

"Server=localhost;Database=ConnectCOBOL;Uid=chris;Pwd=password;factory=MySql.Data.MySqlClient;"

end-exec

View solution in original post

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: ListView with WPF in Visual Cobol

Jump to solution

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.

Example:

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

View solution in original post

0 Likes
4 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: ListView with WPF in Visual Cobol

Jump to solution

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.

Example:

exec sql

  connect using

"Server=localhost;Database=ConnectCOBOL;Uid=chris;Pwd=password;factory=MySql.Data.MySqlClient;"

end-exec

View solution in original post

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: ListView with WPF in Visual Cobol

Jump to solution

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?

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: ListView with WPF in Visual Cobol

Jump to solution

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.

Example:

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

View solution in original post

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: ListView with WPF in Visual Cobol

Jump to solution

Thanks for your help

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.