如何将数据库中的特定记录导入到系统中并将其转换为字符串以进行比较?
事情是这样的,它是一个登录表单,我需要区分大小写的验证,换句话说,如果您的用户名 = Admin 那么 Admin != admin
考虑这个代码块(VB 对我来说真的不熟悉,所以轻轻地把它打破给我^ ^) 这是在将数据库中的记录与传递给函数 LogIn() 的参数匹配之后,
If dataTable.Rows.Count > 0 Then
'case-sensitive Validation follows
'data in Column ID and Password are placed in variables
'which are then compared to the arguments sent using the Compare() function
Dim strID = dataTable.Columns("U_ID").
Dim strPass = dataTable.Columns("Password")
Dim idResult As Integer 'both results will hold the value of String.Compare()
Dim passwordResult As Integer
*idResult = String.Compare(strID, ID)
星号行返回错误(显然),因为 strId 不是字符串数据类型。 这就是我的困境。
我也尝试使用 LIKE,但由于 strId 和 strPass 不是字符串,我得到的只是一个错误。
Here's the deal, it's a log in form and I need to put case-sensitive validation, in other words if your Username = Admin then Admin != admin
Consider this code block (VB is really unfamiliar for me so break it to me gently ^^)
This is after it has matched a record in the database to the parameter passed to the function LogIn()
If dataTable.Rows.Count > 0 Then
'case-sensitive Validation follows
'data in Column ID and Password are placed in variables
'which are then compared to the arguments sent using the Compare() function
Dim strID = dataTable.Columns("U_ID").
Dim strPass = dataTable.Columns("Password")
Dim idResult As Integer 'both results will hold the value of String.Compare()
Dim passwordResult As Integer
*idResult = String.Compare(strID, ID)
the asterisk-ed line returns an error (obviously) as strId is not of data type String.
That's my dilemma.
I also tried using LIKE but again since strId and strPass are not Strings, all I get is an error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将此行:更改
为:
Change this line:
to this: