asp.net 返回错误的参数值 [英] asp.net Returning Wrong Value with parameter
问题描述
所以我有一个搜索返回工作......但是它没有在数据库中找到确切的条目......
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.
如果我将查询更改为 WHERE
GUID= @prmGUID"
,它将返回为 null
值.
If I change my query to WHERE
GUID= @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屋!