access里面的自动编号在SQL语句里面怎么调用,或者谁帮我改改,老是提示标准表达式中数据类型不匹配
这是页面的<%StringgoodsID=request.getParameter("goodsID");Stringgoodsname=request.getParam...
这是页面的
<% String goodsID=request.getParameter("goodsID");
String goodsname=request.getParameter("goodsname");
String price=request.getParameter("price");
String factory=request.getParameter("factory");
String number=request.getParameter("number");
String productid=request.getParameter("productid");
String introduction=request.getParameter("introduction");
GoodsDao goodsdao=new GoodsDao();
int count=goodsdao.updataGoods(goodsname,price,factory,number,productid,introduction,goodsID);
if(count==0){
out.print("修改失败");
}else{
Goods goods=goodsdao.selByname(goodsname);
}
%>
这是方法
public int updataGoods(String goodsname,String price,String factory,String number,String productid,String introduction,String id)
{
int count = 0;
Conn conn= new Conn();
Connection con = conn.getConnection();
try
{
Statement st = con.createStatement();
String sql = "update goods set goodsname='"+goodsname+"',price="+price+",factory='"+factory+"',goodsnumber="+number+",productid="+productid+",introduction='"+introduction+"' where id=9";
sql=sql+id;
count = st.executeUpdate(sql);
conn.closeCon(con, st, rs);
}
catch(SQLException e)
{
e.printStackTrace();
}
return count;
} 展开
<% String goodsID=request.getParameter("goodsID");
String goodsname=request.getParameter("goodsname");
String price=request.getParameter("price");
String factory=request.getParameter("factory");
String number=request.getParameter("number");
String productid=request.getParameter("productid");
String introduction=request.getParameter("introduction");
GoodsDao goodsdao=new GoodsDao();
int count=goodsdao.updataGoods(goodsname,price,factory,number,productid,introduction,goodsID);
if(count==0){
out.print("修改失败");
}else{
Goods goods=goodsdao.selByname(goodsname);
}
%>
这是方法
public int updataGoods(String goodsname,String price,String factory,String number,String productid,String introduction,String id)
{
int count = 0;
Conn conn= new Conn();
Connection con = conn.getConnection();
try
{
Statement st = con.createStatement();
String sql = "update goods set goodsname='"+goodsname+"',price="+price+",factory='"+factory+"',goodsnumber="+number+",productid="+productid+",introduction='"+introduction+"' where id=9";
sql=sql+id;
count = st.executeUpdate(sql);
conn.closeCon(con, st, rs);
}
catch(SQLException e)
{
e.printStackTrace();
}
return count;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询