字节后台打印程序打印中的语法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脚本中出错。它是字节,但我有字符串中的数据?你能帮我吗?感谢之前:)

您只对最后一个字符串执行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()
);

相关内容

  • 没有找到相关文章

最新更新