可能重复:
在提交之前撤消git add
当我在处理我的项目时,我意外地使用以下命令添加了文件
git add file
Run Code Online (Sandbox Code Playgroud)
我还没跑
git commit.
Run Code Online (Sandbox Code Playgroud)
如何从提交中撤消或删除这些新添加的文件?
请帮忙.
我正在使用jQuery验证插件进行客户端验证,但我的验证不适用于我的选择框.
HTML
<select id="select" class="required">
<option value="-1">Choose</option>
<option value="child">test2</option>
</select>
Run Code Online (Sandbox Code Playgroud)
JavaScript的
$("#formid").validate({
select: {
required: function(element) {
if ($("#select").val() == '-1') {
return false;
} else {
return true;
}
}
}
});
Run Code Online (Sandbox Code Playgroud)
我该如何工作?
我的源代码具有以下结构:
SourceFolder
AddProduct.jsp
源包
- 控制器(Servlet)
SaveProduct.java
- 模型(Db操作)
ProductDbOperations.java
我在产品表中插入一个新产品,同时我在product_collection表(product_id | collection_id)中插入一个条目.
要在product_collection表中插入一个条目,我需要从product表中获取生成的id .之后,将在product_collection表中插入一个新条目.
此外,我没有使用任何框架,并使用Netbeans 7.3.
问题:
使用此代码将新条目插入到产品表中
IN:ProductDbOperations.java
try
{
this.initConnection(); // Db connection
pst = cn.prepareStatement("INSERT INTO product values('"+name+"', "+quantity+", "+price+")");
rs = pst.executeUpdate();
}
catch(SQLException ex)
{
}
Run Code Online (Sandbox Code Playgroud)
我也使用以下链接的解决方案,这对我不起作用.我没有任何SQL异常
所以帮助我找出为什么这段代码不适合我.太感谢了.