TableAdapters.Fill不区分大小写 [英] TableAdapters.Fill not case sensitive
问题描述
大家好,
如果没有在正确的地方发布,请道歉,但我在列表中找不到合适的区域!
Apologies if this isn't posted in the right place, but I couldn't find the appropriate area in the list!
这是一个非常快速的问题...
Its quite a quick question...
我有一个WPF应用程序(VS 2017),我使用VS内置的DataSet / TableAdapters连接到数据库。设置 我可以非常高兴地选择,插入,删除等...但是我需要处理一个登录表单并将输入的用户名转换为
lowercase(因为令人讨厌)数据库在人员用户名中有一些高位字符,例如:'JoeBlogs '所以如果用户输入'joeblogs'就找不到它。
I have a WPF application (VS 2017) that I have connected to a database using the VS in-built DataSet/TableAdapters setup. I can quite happily select, insert, delete etc... however I need to process a login form and convert the username inputted to lowercase as (rather annoyingly) the database has some upper characters in peoples usernames eg: 'JoeBlogs' so if a user inputs 'joeblogs' it cant be found.
我似乎无法使用UPPER(用户名)或LOWER(用户名),因为它们都是未知功能。 如何在查询生成器中执行此操作?可以吗?
I cant seem to use UPPER(username) or LOWER(username) as they're both unknown functions. How do I do this in the query builder? Can it be done?
推荐答案
>> 我似乎无法使用UPPER(用户名)或LOWER(用户名),因为它们都是未知功能。 如何在查询生成器中执行此操作?可以吗?
你好shilton32,
Hi shilton32,
根据你的描述,你在你的wpf项目中使用TableAdapter,你想要输入小写字符串,然后就可以在数据库中找到当前数据了。
According to your description, you use TableAdapter in your wpf project, you want to enter lowercase string, then you can find the current data in database.
首先,我不建议你这样做,因为它不安全,但如果你还想这样做,你可以按照这些步骤进行操作。
Firstly, I don't suggest you do this, because it is not safe, but if you still want to do this, you can following the steps.
Fitsyly,我为TableAdapter创建了新的查询,如下所示:
Fitsyly, I create new query for TableAdapter, like this:
然后您可以使用NameQuery方法通过您输入的字符串获取数据。
Then you can use the NameQuery method to get the data by the string you enter.
private void btn1_Click(object sender, RoutedEventArgs e)
{
DataSet1 dataset = new DataSet1();
DataSet1TableAdapters.test16TableAdapter test16adapter = new DataSet1TableAdapters.test16TableAdapter();
string name= test16adapter.NameQuery("cherry").ToString();
}
这是我的表格:
最诚挚的问候,
Cherry
这篇关于TableAdapters.Fill不区分大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!