Fill gridview checkbox through SQL Server

1

I have a checkbox in the gridview and I want to load 'bit' fields in the SQL Server bd in this checkbox, that is, if it is 'True' the checkbox is 'checked'.

I have this:

connect = CONN(un, passwords, db, ip);
String query = "select * from all";
try 
{
    connect = CONN(un, passwords, db, ip);
    Statement statement = connect.createStatement();
    rs = statement.executeQuery(query);
    List<Map<String, String>> data = null;
    data = new ArrayList<Map<String, String>>();
    while (rs.next()) {
        Map<String, String> datanum = new HashMap<String, String>();
        datanum.put("A", rs.getString("a"));
        datanum.put("B", rs.getString("b"));
        datanum.put("C", rs.getString("c"));
        datanum.put("D", rs.getString("d"));
        data.add(datanum);
    }
    String[] from = { "A", "B" , "C", "D" };
    int[] views = { R.id.txtA ,R.id.txtB,R.id.txtC,R.id.txtD};
    final SimpleAdapter ADA = new SimpleAdapter(AMGrid.this,
    data, R.layout.template, from, views);
    gridview.setAdapter(ADA);
} catch (SQLException e) 
{
    e.printStackTrace();
}
    
asked by anonymous 12.10.2016 / 22:47

0 answers