asp.net 返回错误的参数值 [英] asp.net Returning Wrong Value with parameter

查看:41
本文介绍了asp.net 返回错误的参数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个搜索返回工作......但是它没有在数据库中找到确切的条目......

So I Got a search return to work... however it's not finding the exact entry in the database...

MySqlConnection con = new MySqlConnection(dbConnection);
                MySqlCommand cmd;
                con.Open();
                MySqlDataReader dbReader;
                string cmdText = "SELECT `BanID`, `GUID`, `BanTime`, `Reason`, `BanType`, `Proof` FROM `a3bans`.`bans` WHERE  `GUID` LIKE @pGUID";


                cmd = new MySqlCommand(cmdText, con);

                cmd.Parameters.AddWithValue("@pGUID", "%" + bans.GuidOrIP + "%");

当我搜索 "e7af78997ef220a557c97a1a4c11e0c2" 这是个人 ID 时,它返回与 "fa32f7c456b368e17a278f3b165a550d" 完全不同的个人 ID.

When I search for "e7af78997ef220a557c97a1a4c11e0c2" which is a persons ID, it returns with "fa32f7c456b368e17a278f3b165a550d" which is a completely different persons ID.

如果我将查询更改为 WHEREGUID= @prmGUID",它将返回为 null 值.

If I change my query to WHEREGUID= @prmGUID" it returns as null value.

我做错了什么,它不会返回我正在寻找的字符串?

What am I doing wrong that it wont return the string I am looking for?

推荐答案

它实际上与此无关,lol 我有 2 个非常相似的变量并将它们混淆...

It actually had nothing to do with this, lol I had 2 variables very similar and got them mixed up...

谢谢大家的帮助

这篇关于asp.net 返回错误的参数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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