当试图将数据插入到字符串中时,它会发出一个警告,这是我的整个单一陈述......?我没有得到什么错误.. 任何帮助将不胜感激 在此先感谢
NSString *insertSQL=[NSString stringWithFormat:@"INSERT INTO userinfo(userid,empcode,firstname,middlename,lastname,emailid,mobileno)VALUES(\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\")",txtUserId.text,txtEmpCdoe.text, txtFname.text,txtMname.text,txtLname.text, txtEmailId.text,txtMobileNob.text,txtUserId.text ,txtRole.text,txtBrands.text,txtRegionId.text,txtZoneId.text,txtDistrictId.text,txtDealerId.text,txtDealerName.text,txtUserId.text,txtDesignation.text,txtCategoryName.text,txtProfileImageName.text,txtUserId.text,txtUserId.text,txtProfileImagePath.text];
答案 0 :(得分:0)
此问题(可能还有其他问题)是提供的参数数量与格式字符串预期的数量不匹配。一般来说:
BAD:
[NSString stringWithFormat:@" %@ %@ ", aString, anotherString, aThirdString];
[NSString stringWithFormat:@" %@ %@ %@ %@ ", aString, anotherString];
行:
[NSString stringWithFormat:@" %@ %@ ", aString, anotherString];
在您的情况下,以下内容会更有意义,但请检查输入:
NSString *insertSQL=[NSString stringWithFormat:@"INSERT INTO userinfo(userid,empcode,firstname,middlename,lastname,emailid,mobileno)VALUES(\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\")",txtUserId.text,txtEmpCdoe.text,txtFname.text,txtMname.text,txtLname.text, txtEmailId.text,txtMobileNob.text];