select * from table where id=1001 正確,若id爲int類型,此處單引號可加可不加
select * from table where id='1001' 正確
select * from table where id=1001 在實際程序中使用字符串拼裝的方法拼湊這一句話,不管單引號使用與否,在實際的拼裝中都應將非字符串類型轉換爲字符串類型,例如:QString strExec = "select * from table where id="+QString::number( 1001 );