日期:2014-05-16 浏览次数:20358 次
<script type="text/javascript"> function Query() { if (form1.spbh.value == "") { alert("商品编号不能为空"); form1.spbh.focus(); return false; } //form1.submit(); <% String spbh = request.getParameter("spbh"); Connection conn = null; Statement statement = null; ResultSet result = null ; Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); conn = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;database=SuperMarket;user=sa;password=123"); statement = conn.createStatement(); result = statement.executeQuery( "select * from TB_SHANGPIN where SPBH ='" + spbh + "'"); %> var otr=myTable.insertRow(i); var ocell=otr.insertCell(0); ocell.innerHTML= "<td style='width: 90px;' align='center'>"+result.getString(1)+"</td>"; var ocell=otr.insertCell(1); ocell.innerHTML= "<td style='width: 90px;' align='center'>"+result.getString(2)+"</td>"; var ocell=otr.insertCell(2); ocell.innerHTML= "<td style='width: 90px;' align='center'>"+result.getString(3)+"</td>"; var ocell=otr.insertCell(3); ocell.innerHTML= "<td style='width: 90px;' align='center'><input style='test'/></td>"; var ocell=otr.insertCell(4); ocell.innerHTML= "<td style='width: 90px;' align='center'>"+result.getString(4)+"</td>"; var ocell=otr.insertCell(5); ocell.innerHTML= "<td style='width: 90px;' align='center'>"+result.getString(5)+"</td>"; var ocell=otr.insertCell(6); ocell.innerHTML= "<td style='width: 90px;' align='center'>"+result.getString(6)+"</td>"; var ocell=otr.insertCell(7); ocell.innerHTML= "<td style='width: 90px;' align='center'>"+result.getString(8)+"</td>"; var ocell=otr.insertCell(8); ocell.innerHTML= "<td style='width: 90px;' align='center'><a href='#'>删除</a></td>"; i++; } </script>