如何使用支票可用性

如何使用支票可用性

本文介绍了如何使用支票可用性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想检查访问数据库中数据的可用性.它有名字和姓氏.我要检查两个名字.如果两者相同,则应显示味精警报.

你能帮助我吗?请尽快回复.

谢谢
问候,
Sangeetha

Hi,

I want to check the availability of the data in access database. It have first name and last name feilds. I want to check both name. If both are same then it should show the msg alert.

Can you help me? Please reply as soon as possible.

Thank you,
Regards,
Sangeetha

推荐答案

select count(*) from table1 where fname = lname;


如果count大于1,则存在名字和姓氏相同的记录.


if count is more then 1 then record exists where first name and last name is same.

select fname, lname from table1 where fname = lname;



获取fname和lname


如果fname和lname是用户输入,则尝试此查询



To get the fname and lname


If fname and lname is user input then, try this query

select count(*) from table1 where fname = firstname name and lname = lastname;



如果count大于1,则记录存在名字和姓氏的地方.



if count is more then 1 then record exists where first name and last name is exists.


SELECT * FROM TABLENAME WHERE FIRSTNAME = @FIRSTNAME AND LASTNAME = @LASTNAME



3)如果查询返回的任何数据意味着数据库中的名字和姓氏已经存在,并且如果存在,那么您可以向用户发送一条消息,告知该名字已经存在.

4)或查询不返回任何数据意味着在数据库中没有使用该名称存储的内容,因此您可以触发插入式查询来存储数据....



3) IF your query returns any data that means in your database that first name and last name are already exist and if it so, then you can give a message to user that that name already exist.

4) or your query does not return any data means that in your database nothing store with that name so you can fire your inset query for storeing data....



这篇关于如何使用支票可用性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 07:55