Mahdi_Nine
Mahdi_Nine

Reputation: 14751

problem with bit in mysql

resultset = statemet.executequery("select shift+0 from sportman");

string x = resultset.getstring("shift");

but second line throw exception:

Column 'shift' not found.

shift is bit(8) and i want to show it to form '000101'.

Upvotes: 0

Views: 432

Answers (1)

sjr
sjr

Reputation: 9875

Integer.toBinaryString(Integer.valueOf(resultset.getString("shift+0")))

Result is not zero-padded to the width you want though. You may need to add that yourself later.

Upvotes: 1

Related Questions