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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sanjeeb LenkaPosted Sep 4, 2013, 7:33 AM
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 TalikotiPosted Sep 4, 2013, 7:34 AM
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
}