Now while inserting contact no in user or vendor, i want to check weather that contact no is exist in both tables or not....
i don't have any common field in both tables.
How i ll do this?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Sep 4, 2013, 3:33 AM EDT
In the textbox textchanged event check the contactno in database. if found then show a msg. if not then allow the no.
you can use this query to get the contact no from both the tables.
SELECT e.contact
FROM
(SELECT vendor_contact as contact FROM vendors
UNION
SELECT user_contact as contact FROM users)
AS e
where
e.contact='7842392529'
in above query i use contact no datatype as varchar. if you used bigint then remove the double coat.
Kiran Kumar TalikotiRank #814 · 2.8K reputationPosted Sep 4, 2013, 3:34 AM EDT
May be this will work for you,do check not sure
var query=from c in DB.Users
from d in DB.Vendors
where c.Moble_No==d.Mobile_no
select new
{
};
if(query!=null)
{
messagebox.show("Contact Exist");
}
else
{
//logic for accepting mobile_no
}