[SQL]为什么我的程序无法正常工作?

问题描述:

我有一个非常简单的过程,由于某种原因,当我使用Visual Studio的数据库激活它时,它可以工作,但是当我从代码中使用它时,它就失败了(提取的值是如果有这样的用户,则从0而不是1).

I have this extremely simple procedure, and for some reason it works when I''m activating it using the Visual Studio''s Database thingy, but fails when I''m using it from my code (the extracted value is 0 instead of 1 when there''s such a user).

CREATE PROCEDURE Client_Authenticate
 (@ID int,@Password varchar(32),@OutAuthenticated tinyint OUTPUT) AS
 BEGIN
 	SELECT * FROM _Clients WHERE ClientID = @ID AND MD5Hash = @Password
	SET @OutAuthenticated = @@ROWCOUNT
 END



同样,以下过程从代码执行时似乎什么也没做.



Also the following procedure seem to do nothing when executed from code.

CREATE PROCEDURE Client_ConnectionChanged
 (@ID int,@Value tinyint) AS
 BEGIN
 UPDATE _Clients SET ClientConnected = @Value WHERE ClientID = @ID
 END


Visual Studio数据库问题吗?我不熟悉该工具:)

没有理由将存储的proc在一个环境中工作而在另一个环境中失败.确保连接到相同的数据库,并且正在处理所有异常.您还可以使用SQL Sever配置文件来监视正在发生的事情
Visual Studio Database thingy? I''m unfamiliar with that tool :)

There would be no reason a stored proc would work in one environment and fail in another. Make sure you are connecting to the same database and you are handling any exceptions. You can also SQL Sever profile to monitor what is happening