sql自动插值的怎么写

来源:百度知道 编辑:UC知道 时间:2024/09/23 01:30:20
String strSQL1="INSERT INTO reply";
strSQL1+="(topic,floor,authorname,content)";
strSQL1+="values(";
strSQL1+="'"+topicid+"',";
strSQL1+="'',";//这里怎么写,我已经把int弄为自动增长的了
strSQL1+="'"+id+"',";
strSQL1+="'"+content+"')";
strSQL1+="'',";//这里怎么写,我已经把floor弄为int自动增长的了

String strSQL1="INSERT INTO reply";
strSQL1+="(topic,authorname,content)";
strSQL1+="values(";
strSQL1+="'"+topicid+"',";
strSQL1+="'"+id+"',";
strSQL1+="'"+content+"')";

---
以上,希望对你有所帮助。

没听明白

几乎所有的数据库都支持写NULL,也就是(注意没有引号):
strSQL1+="NULL,";//这里怎么写,我已经把floor弄为int自动增长的了

一般的数据库可以对整型写0,对字符类型写''

自动增长的就不用写!
你就不往那个字段插值,当你把其他字段插入值后,它就会自动增长,你可以试试。