2016-01-12 31 views
0

我不能分辨這句法:錯誤syntac ZPL字符串轉換成字節假脫機打印

printerConnection.write(configLabel = "^FO80,160 ^BY1,2.0,180^BCN,180,Y,N,N^FD" + nor + "^FS".getBytes());//error in here 

printerConnection.write(configLabel = "^FO250,400 ^A0,38,38^FD" + name + "^FS" .getBytes());//error in here 

printerConnection.write(configLabel = "^XZ".getBytes()) 


//its Query for input to syntax ZPL 

sql1= "SELECT norm as a1, " 
+ "name as a " 
+ "from xytable" 
+ "where nor ="+noRParameter+" "; 
java.sql.Statement stmt=koneksi.createStatement(); 
java.sql.ResultSet rslt=stmt.executeQuery(sql1); 
while(rslt.next()){ 
String nor = rslt.getString("nor"); 
String name = rslt.getString("name");} 

我在劇本ZPL遇到錯誤。這是字節,但我有字符串中的數據?你可以幫我嗎?以前感謝:)

回答

0

你只對最後一個字符串執行getBytes()方法。
您需要類似的東西:

printerConnection.write(
    // Note the added parents around the String you want to execute getBytes() on. 
    configLabel = ("^FO80,160 ^BY1,2.0,180^BCN,180,Y,N,N^FD" + nor + "^FS").getBytes() 
);