当前位置: 技术问答>java相关
wrong???
来源: 互联网 发布时间:2015-06-13
本文导语: String sql="select * from productinfo"; stm=conn.prepareStatement(sql); rs1=stm.executeQuery(); 有错吗? | 没有错。 String sTemp = "select BookNo, Name, EnglishName, Sex, Company, Department, Position, Email, Offic...
String sql="select * from productinfo";
stm=conn.prepareStatement(sql);
rs1=stm.executeQuery();
有错吗?
stm=conn.prepareStatement(sql);
rs1=stm.executeQuery();
有错吗?
|
没有错。
String sTemp = "select BookNo, Name, EnglishName, Sex, Company, Department, Position, Email, OfficeTel, OfficeFax, Mobile, BP, HomeCountry, HomeCity, HomeDistrict, HomeStreet, HomePostCode, HomeTel1, HomeTel2, Description, Birthday, NativePlace, CompanyCountry, CompanyCity, CompanyDistrict, CompanyStreet, CompanyPostCode, EMPID,OPENFLG from TBL_PERSONALADDRESSBOOK where ( empid = ? ) OR (empid ? AND OPENFLG = ? ) order by email";
try
{
preparedstatement = connection.prepareStatement(sTemp);
preparedstatement.setInt(1, b);//这些你有没有设
preparedstatement.setInt(2, b);
preparedstatement.setString(3, "1");
resultset = preparedstatement.executeQuery();
...........
String sTemp = "select BookNo, Name, EnglishName, Sex, Company, Department, Position, Email, OfficeTel, OfficeFax, Mobile, BP, HomeCountry, HomeCity, HomeDistrict, HomeStreet, HomePostCode, HomeTel1, HomeTel2, Description, Birthday, NativePlace, CompanyCountry, CompanyCity, CompanyDistrict, CompanyStreet, CompanyPostCode, EMPID,OPENFLG from TBL_PERSONALADDRESSBOOK where ( empid = ? ) OR (empid ? AND OPENFLG = ? ) order by email";
try
{
preparedstatement = connection.prepareStatement(sTemp);
preparedstatement.setInt(1, b);//这些你有没有设
preparedstatement.setInt(2, b);
preparedstatement.setString(3, "1");
resultset = preparedstatement.executeQuery();
...........
|
没错呀!不过你如果只是进行这样定下来的查询的话,建议你还是使用Statement简单!
|
no
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。