【发布时间】:2016-08-03 16:38:40
【问题描述】:
我如何执行我的存储过程。 该程序在我直接从 sql 执行时有效,但当我从平板电脑执行时它不起作用
String itemshelf = DBshelf;// edittext for putting in values on set
String itemcard = DBcard;// edittext for putting in values on where
PreparedStatement preparedStatement = con.prepareStatement("EXEC [dbo].[spUpd_Location]");
preparedStatement.executeUpdate();
我的存储过程
ALTER PROCEDURE [dbo].[spUpd_Location]
@itemshelf nvarchar(1000)=NULL
, @itemcard nvarchar(1000)=NULL
AS
SET NOCOUNT ON
UPDATE PS
SET [ShelfNumber]=@itemshelf
FROM [file].[ItemPart] PS
JOIN [file].[Item] P ON P.[id] = PS.[id]
where [ItemNumber]=@itemcard
【问题讨论】:
-
有什么错误? executeUpdate 看起来不对,因为那不是直接更新
-
我没有收到任何错误,但它不会更改数据库中的值
-
@itemcard 为 NULL,因此所有行的相等性测试都是错误的,用 2 个参数调用它? (如果你想与 null 相等,使用 IS NULL)
-
在我删除 null 后,我得到了未提供的预期参数“@itemshelf”。在我准备好的陈述中
标签: android sql-server stored-procedures