Quote Originally Posted by SuperSonik View Post
Qt Code:
  1. void sendRequest(void) {
  2. QByteArray block;
  3. QDataStream out(&block, QIODevice::WriteOnly);
  4. out.setVersion(QDataStream::Qt_4_2);
  5. QString abfrage("SELECT * FROM Datum; \r\n");
  6.  
  7. out << abfrage.toAscii();
  8. out.device()->seek(0);
  9. out << quint16(block.size() - sizeof(quint16));
  10. tcpsocket.write(block);
  11. pushButton_abfragen->setText(tcpsocket.errorString());
  12. };//sendRequest
To copy to clipboard, switch view to plain text mode 
I'm not sure if this code is really what you wanted to do. toAscii() method converts QString to QByteArray. QByteArray written to QDataStream is represented as array size (quint32) followed by the array bytes. So in block variable you have something like this:
Qt Code:
  1. [x][x][x][x][S][E][L][E][C][T][...]
To copy to clipboard, switch view to plain text mode 
and then you rewind to position 0 and overwrite first two bytes:
Qt Code:
  1. [y][y][x][x][S][E][L][E][C][T][...]
To copy to clipboard, switch view to plain text mode 
Is this realy what you wanted?