[英]VB.Net Query For MYSQL Query finding in set
i have a table 'Users' that consists of ID Name BranchAccess Username Passwordd我有一个表“用户”,其中包含 ID 名称 BranchAccess 用户名 Passwordd
now in BranchAccess i put the ids of the branches BranchAccess = 2,3,11现在在 BranchAccess 我把分支的 ID BranchAccess = 2,3,11
how can i query that in vb.net?我如何在 vb.net 中查询? that will be like this
会是这样的
+----+----------+----------+------------------------+
| id | username | password | BranchAccess(varchar) |
+----+----------+----------+------------------------+
| 1 | bob | ******** | 1,3,11 |
| 2 | mary | ******** | 2,8,5 |
| .. | ........ | ........ | ...................... |
+----+----------+----------+------------------------+
QueryConnect = "SELECT * From users Where BranchAccess=@BAccess"
CommandConnect = New MySqlCommand(QueryConnect, DataConnection)
CommandConnect.Parameters.Add("@BAccess", MySqlDbType.VarChar).Value = SBIDLabel.Text
Thanks For Your Answer Guys i was able to find a solution using this感谢您的回答伙计们,我能够使用此找到解决方案
QueryConnect = "SELECT * FROM users WHERE FIND_IN_SET(@BAccess, BranchAccess)>0"
CommandConnect = New MySqlCommand(QueryConnect, DataConnection)
CommandConnect.Parameters.Add("@BAccess", MySqlDbType.VarChar).Value = SBIDLabel.Text
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.