从 .NET TableAdapter 调用的具有参数化参数的 MySQL 存储过程不过滤数据
我正在使用连接字符串直接连接到我的本地 MySql 数据库。当我尝试以下操作时:
Dim dtUsers As New dtUsers.UsersDataTable
Dim taUsers As New dtUsersTableAdapters.UsersTableAdapter
dtUsers = taUsers.GetDataByUsername_Password("useracct1", "userpw1")
当我在调试模式下查看 dtUsers 的结果时,它返回数据库中的所有行,并且不会将它们过滤为仅包含用户名:useracct1 和密码:userpw1 的记录。
存储过程在 MySql Workbench GUI 中正确执行,但由于某种原因,结果未被过滤。我还没找到有同样问题的人。
MySql 存储过程如下所示:
-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$
CREATE DEFINER=(backtickhere)root(backtickhere)@(backtickhere)localhost(backtickhere) PROCEDURE (backtickhere)Users_ByUsername_Password(backtickhere)(IN Username VARCHAR(25),
IN Password VARCHAR(25))
BEGIN
SELECT ID, Email, Password, DoB, Status, SessionID, FirstName, LastName, Icon, Username, Quote, Location, ImgType, PrivateAcct, CommentNotify, TaggedNotify,
FollowedNotify
FROM Users
WHERE (Username = @Username) AND (Password = @Password);
END
所有内容也在强类型数据集中的 TableAdapter 中正确定义和设置。
I am using a connection string to directly connect to my local MySql database. When I try the following:
Dim dtUsers As New dtUsers.UsersDataTable
Dim taUsers As New dtUsersTableAdapters.UsersTableAdapter
dtUsers = taUsers.GetDataByUsername_Password("useracct1", "userpw1")
When I look at the results of dtUsers in debugging mode, it returns all of the rows from the database and isn't filtering them to only the record with the username: useracct1 and the password: userpw1.
The stored procedures execute correctly in the MySql Workbench GUI, but for some reason, the results are not being filtered. I haven't been able to find anyone with this same issue.
MySql Stored Procedure looks like the following:
-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $
CREATE DEFINER=(backtickhere)root(backtickhere)@(backtickhere)localhost(backtickhere) PROCEDURE (backtickhere)Users_ByUsername_Password(backtickhere)(IN Username VARCHAR(25),
IN Password VARCHAR(25))
BEGIN
SELECT ID, Email, Password, DoB, Status, SessionID, FirstName, LastName, Icon, Username, Quote, Location, ImgType, PrivateAcct, CommentNotify, TaggedNotify,
FollowedNotify
FROM Users
WHERE (Username = @Username) AND (Password = @Password);
END
Everything is also defined and setup correctly in the TableAdapter in the strongly typed DataSet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论