Java MessageFormat - How can I insert values between single quotes?

前端 未结 5 1822
渐次进展
渐次进展 2020-12-05 09:03

I\'m having a problem using the java.text.MessageFormat object.

I\'m trying to create SQL insert statements. The problem is, when I do something like this:

5条回答
  •  佛祖请我去吃肉
    2020-12-05 09:53

    First thing that came to mind was to change str1, str2, str3 to have the single quotes around them.

    Object[] args = { str0, "'" + str1 + "'", "'" + str2 + "'", "'" + str3 + "'", str4 };
    

    Then, of course, remove the single-quotes from your query string.

提交回复
热议问题