来自数据库的文本框验证 [英] TextBox Validation From Database

查看:77
本文介绍了来自数据库的文本框验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Form1用户中输入保存在表1中的汽车名称,例如(本田,丰田,宝马....).在Form2用户中,输入颜色(例如,黑色,白色,银色)存储在Table2中.在Form3中,我想要当用户尝试在文本框中输入错误的拼写"HONDX"时,使用具有表1中数据的新帮助表单用户从那里选择,然后转到另一个文本框.
但是,如果用户输入正确的拼写本田在文本框中没有帮助表单显示,只需转到另一个文本框即可.
请告诉我如何验证数据库表中的TextBox数据.

In Form1 user enter the car names e.g(HONDA, TOYOTA, BMW....) which saves in the Table1. In the Form2 user enter the colour e.g(BLACK, WHITE, SILVER which saves in the Table2. In the Form3, i want when user try to write wrong spelling " HONDX "in the textbox, new help form which have data from Table1 user select from there then go to the other textbox.
But if user write the correct spelling " HONDA " in the text box no help form shows just go to the other text box.
Please tell me how I validate TextBox data from the Database table.

推荐答案

我会将可用的制造商加载到列表中,然后将文本框的内容与该列表进行比较.如果找不到匹配项,则会生成一条错误消息.当然,您可以通过提供一个包含列表中内容的下拉列表来完全消除该过程,并允许用户从下拉列表中进行选择,从而消除了他输入无效数据的机会.
I would load the available manufacturers into a list and compare the contents of the textbox to the list. If it doesn''t find a match, an error message is generated. Of course, you could eliminate that process altogether by providing a drop down that contains what''s in the list, and allow the user to pick from the drop down, thus eliminating the chance he could enter invalid data.


这篇关于来自数据库的文本框验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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