Skip to content Skip to sidebar Skip to footer

Java.util.missingformatargumentexception: Format Specifier: S

I am trying to add data to SQLite database in android, But I am getting error, 'java.util.MissingFormatArgumentException: Format specifier: s'. I tried to figure out the problem bu

Solution 1:

String query = String.format("INSERT INTO OrderDetails(Productid,ProductName,Quantity,Price,Discount,Image) VALUES('%s','%s','%s','%s','%s','%s');",
        order.getProductid(),
        order.getProductName(),
        order.getQuantity(),
        order.getPrice(),
        order.getDiscount());

You have six %s format placeholders but you're supplying only five values.

Solution 2:

MissingFormatArgumentException

Unchecked exception thrown when there is a format specifier which does not have a corresponding argument or if an argument index refers to an argument that does not exist.

You didn't set a value for the 'Image' parameter

Post a Comment for "Java.util.missingformatargumentexception: Format Specifier: S"