[SQL]为什么我的程序无法正常工作? [英] [SQL] Why doesn't my procedure work properly?

查看:130
本文介绍了[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


这篇关于[SQL]为什么我的程序无法正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆